On Wed, Jun 11, 2014 at 4:48 AM, Grant Edwards <invalid@invalid.invalid> wrote:
> I've seen some amazingly convoluted C code where people got themselves
> wrapped around the axle six different ways in order to avoid using
> "goto fail" or "goto retry".  Invariably I was looking at the code
> because it didn't work right and needed to be fixed.  Usually the
> addition of a 'fail' label and a few gotos allowed me to throw out all
> sorts of complexly nested if/else blocks, status flags, and
> unnecessary while loops.  Usually you can reduce the number of lines
> of code (sometimes by half or more) while also reducing the number and
> nesting of control structures.  And when you're done it works right!

Yeah. As soon as you take on board a hard-and-fast rule, you open
yourself up to stupid cases where the rule ought to have been broken.
I don't know a single piece of programming advice which, if taken as
an inviolate rule, doesn't at some point cause suboptimal code.


Reply via email to