Deutsch English Français Italiano |
<87y147zxve.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.lang.c Subject: Re: Code guidelines Date: Wed, 04 Sep 2024 00:22:45 -0700 Organization: None to speak of Lines: 20 Message-ID: <87y147zxve.fsf@nosuchdomain.example.com> References: <vb6v1t$3b5mb$1@dont-email.me> <vb726n$3b4rq$1@dont-email.me> <vb736j$3b5mb$2@dont-email.me> <vb75g9$3bntp$1@dont-email.me> <vb77tn$3bu07$3@dont-email.me> <vb7d6l$3d5mv$1@dont-email.me> <vb8vcf$3nlvn$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 04 Sep 2024 09:22:45 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0c8cc2609bc8d9fbbbb3d106ce45f413"; logging-data="3939040"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dTLFiW9aNo33YpNeG6W7J" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:cpgRISpv1nmpxCsFJ1HGVkWrXMQ= sha1:Dvh3dU6dw3AqZ3kbwY6zdlpcKDk= Bytes: 1763 David Brown <david.brown@hesbynett.no> writes: [...] > Before you put any check in code, think about the circumstances in > which it could fail. If there are no circumstances, it is redundant > and counter-productive. [...] One thing to consider is that if a check can never actually fail the recovery code *cannot be tested* (and you can't get 100% code coverage). p = NULL; // assume p is not volatile if (p != NULL) { do_something(); // can never execute this } Of course not all such cases are so easily detectible ( -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */