I break for(;;) loops

preece at ccvaxa.UUCP preece at ccvaxa.UUCP
Fri Oct 4 05:57:00 AEST 1985


/* Terry Poot writes:
> Some of us feel the same about breaks as we do about gotos. I won't use
> it, or continue either, and I won't let anyone in my shop use it. It is
> just a goto with an implicit label, and destroys the ability to
> determine program flow from the FORM of the source even more
> drastically,...
----------
Well, it's nice to be able to infer meaning from form (we love you,
Mies), but break and continue are much clearer than the alternative
of bracketing off the remaining code within the loop.  If there's more
than one break in a loop any other method leads to horrible
structures that may explicitly expose the flow of the program but
are guaranteed to give the reader instant migraine.  I think you
should lay out your code so that the break is very obvious (separate
line, with comment), but you shouldn't avoid using them.

It is unfortunate that they used the same word for breaking from a
loop and terminating a case clause in a switch statement.

-- 
scott preece
gould/csd - urbana
ihnp4!uiucdcs!ccvaxa!preece



More information about the Comp.lang.c mailing list