Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Fixing a sample from K&R book using cake static analyser Date: Mon, 24 Jun 2024 02:21:08 -0700 Organization: A noiseless patient Spider Lines: 21 Message-ID: <86ed8mg0hn.fsf@linuxsc.com> References: <20240623022343.ec355c69a3d9eb03ad4a50f2@gmail.moc> <878qywq7ou.fsf@bsb.me.uk> <20240624013337.36fdb40f0766c6e1c8ce67c7@gmail.moc> <87tthjnsdt.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Mon, 24 Jun 2024 11:21:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b3b1304951eae8dc1e53ef86c96f1e35"; logging-data="910961"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jrTcNKC6cQnQmNxOPU2yahsD59kGnPM4=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:mQtCruHG8AT0KiAw23fc5AfSi/Y= sha1:b226AyrPc0hH7QtI+221SAijgVQ= Xref: csiph.com comp.lang.c:386443 Ben Bacarisse writes: [...] > Trying to make gotos less bad than they can be is not usually an > overall positive. Whenever I see a "good" use of goto, I try to > see if there's a better way with no use of goto. So far [noted an > exception] I have not yet seen one that can't. Some years ago I was revising/rewriting some code, and got to a point where using a goto seemed like the best way to proceed. And it was a really awful goto too, the kind of horror show one might see in an obfuscated C contest. The argument in favor of using the goto is that not using it would have meant a really ugly duplication of part of the algorithm. There is no question that I could have avoided using goto, but in that particular case using goto seemed like a better choice than the alternatives. Generally speaking I share your reaction to using goto. Sometimes though using goto gives a nicer looking result than local-scale alternatives.