Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.lang.c Subject: Re: Code guidelines Date: Wed, 4 Sep 2024 08:45:19 +0200 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 04 Sep 2024 08:45:20 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0366692407b62e2f3ab0bc1ba1697c81"; logging-data="3921912"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wJPUuUXvmG+eOK16vwGs2xztvsMDKnUs=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:ubGTu6SP0wPUPKqmQY6h4ekYSqA= In-Reply-To: Content-Language: en-GB Bytes: 1908 On 03/09/2024 18:37, Thiago Adams wrote: > > I also have a interesting sample with linked list > Speaking generally rather than specifically about this code, your extra checks are redundant when the code is run from a single thread, and insufficient if it is later used from multiple threads (accessing the same data). But extra checks can fool people into thinking it is safe - since the checks are unnecessary for sequential code they must have been put there to catch rare race conditions. There are times when you want seat-belts /and/ airbags. But focusing on that instead of making sure the driver is competent is not helpful!