Breaking out of several nested loops (& ANSI C)

Larry Wall lwall at sdcrdcf.UUCP
Wed Oct 17 03:22:35 AEST 1984


In article <468 at voder.UUCP> gino at voder.UUCP (Gino Bloch) writes:
>Well, I have an opinion too.  I imagine trying to find WHERE the break or
>goto takes me to...

So do I, and so do I...

Hypothetical examples of named breaks never ring quite true, because they
neglect the fact that most loops have a semantic value.  I think this point
has been neglected by the pro-namers.  Named loops (and blocks) are useful
*abstractions*, and it's always nice to be able to name your abstractions.

Arguments about whether your abstraction should be named at the beginning
or the end miss the point.  If a loop is to be labeled, it should be labeled
at both ends.  I can just see it: the Los Angeles City Council argueing about
whether to post an "Entering Los Angeles" sign at the north end or the
south end of I-5...
                                                      _
Now, does that mean we should add named loops to C?  me genoito!
I don't think you should turn C into Ada*, for two reasons:

    1) Those who think they don't like Ada will think they won't like C.
       (Yes, that's what I meant to say.)
    2) Those who think they like Ada will already have switched to Ada.
       (Yes, yes, I know.  Hope springs eternal...)

For all her faults, Ada knows an abstraction when she sees one.  C is easy,
but a clever lady is worth waiting for.

Larry Wall
{allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall

*Ada iartoUSDOD(AJPO).



More information about the Comp.lang.c mailing list