🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3484

Re: Multi-level break and elimination of GOTO

#3484
From: Greg Comeau
Date: Sat, 11 Nov 1995 00:13
49 lines
1945 bytes
In article <47s7l0$r18@news.mel.aone.net.au> andrewd@agnus.livewire.com.au (Andrew Dunbar) writes:
>The only problem I can see is for do loops:
>
>do
>{
>    while inner (exp1)
>    {
>        if (exp2)
>            break outer;
>    }
>} while outer;
>

That's one issue.  That wouldn't work anyway because you do not have
an expression for the do/while.  Which is part of the point of where
things start collapsing with some proposals re things like this.
Because now we can have:

    do .... while outer (expr);


while looks odder (IMO) that the for, but then so does:
    do outer.... while (expr);
      
and any other permutations.

Or to minimize impacts to the grammar, why not just leave as normal labels:

    outer: for(...) { ... }

but that doesn't fly as well, so how about:

    for(...) { ... } outer:

But that seems odd, and further, doesn't work in all cases w/o having
to add a ; or something.

And while we are at it, why not add it to if statements, switches,
(even return! <gasp>) and so on.

The idea is probably nice, and there is prior art from other languages,
however, the impact and tradeoffs get bigger and bigger the more you
look at it within a C/C++ world.

- Greg
-- 
       Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
 Here:comeau@csanta.attmail.com / BIX:comeau or comeau@bix.com / CIS:72331,3421
    Voice:718-945-0009 / Fax:718-441-2310 / Prodigy: tshp50a / WELL: comeau
Technical Details
Message-ID: <480ps3$nqj@panix.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!panix!not-for-mail
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch> <47s7l0$r18@news.mel.aone.net.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!panix!not-for-mail
From: comeau@panix.com (Greg Comeau)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Multi-level break and elimination of GOTO
Date: 10 Nov 1995 19:13:55 -0500
Organization: Comeau Computing
Message-ID: <480ps3$nqj@panix.com>
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch> <47s7l0$r18@news.mel.aone.net.au>
Reply-To: comeau@csanta.attmail.com (Greg Comeau)
NNTP-Posting-Host: panix.com