Sujet : Re: Fixing a sample from K&R book using cake static analyser
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 24. Jun 2024, 10:21:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86ed8mg0hn.fsf@linuxsc.com>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Ben Bacarisse <
ben@bsb.me.uk> 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.