Proposal for breaking out of multiple loops

Cesar Quiroz quiroz at rochester.UUCP
Thu Oct 18 11:29:04 AEST 1984


Some more comments.

> From:            Barry Gold <lcc.barry at UCLA-LOCUS.ARPA>
> 
> . . .
> 
> If "break label;" is to be allowed, the language definition should at least
> allow (if not require) a matching label at the end of the loop.     
> . . .

This is a sound DESIGN idea.  It not only makes the finding (while reading) of
the end of the loop easier, but provides a check the compiler can make for 
essentially every loop (namely, Is this the end of the loop the programmer was
thinking about?)

The only difficulty I can see is that the language would change too much for the
standard to be useful.  Admittedly, the original proposal is half-hearted and
the addition of the final label would improve it.  However, if the original 
proposal finds its way to the standard (fat chance! not even the originator is
defending it any further), NO working C program will be broken.  It's a matter
of compromise: the proposed additions should disturb the language as little as
possible. Some additional functionality should be gained at little cost.

For the final label to be really useful, it need be mandatory. But that seems
a bit too much: current programs will be broken mercilessly.  Maybe a little
bit of programmer's maturity will help, in the form of comments.  But that is
beyond this discussion. (Because we ALL comment at the end of a loop, don't we?)

However, if you can come with a syntax that doesn't break existing programs and
provides the needed cleanliness, be it welcome. (I have my doubts, though. I
think the best solution is terminating keywords for all compound statements
and that crashes heads on with the nice/silly braces).

Cesar



More information about the Comp.lang.c mailing list