🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3460

Re: Multi-level break and elimination of GOTO

#3460
From: Erik Corry
Date: Sat, 04 Nov 1995 19:58
37 lines
1564 bytes
Andrew Dunbar (andrewd@agnus.livewire.com.au) wrote:

: Has anyone thought of the possibility of 'named' loops?

: for outer (x = 0; x < MAXX; x++)
: {
:    for inner (y = 0; y < MAXY; y++)
:    {
:       if (map[y][x] == '*')
:          break (outer);
:    }
: }

Definitely better than break(2) or continue(2), but why not do it the
same way Java does it:

outer:
for (x = 0; x < MAXX; x++)
{
   for (y = 0; y < MAXY; y++)
   {
      if (map[y][x] == '*')
         break outer;
   }
}

It would be a pity to do it differently to Java unless there's
a good reason. Of course the question is, what do we gain by this?
You could trivially do the same with goto. It makes more sense
for continue, actually, which couldn't be done as well with
goto. But it is utterly unrealistic to talk about removing
goto from C9X. Java is in a different situation because it
doesn't have goto in the first place. One of the benefits of
an almost clean slate design.

--
Erik Corry ehcorry@inet.uni-c.dk
Technical Details
Message-ID: <DHJBHK.ILu@kroete2.freinet.de>
Path: arc1-ca.pugleaf.net!kroete2.freinet.de!erik
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch> <47eb7k$ckb@news.mel.aone.net.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!kroete2.freinet.de!erik
From: erik@kroete2.freinet.de (Erik Corry)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Multi-level break and elimination of GOTO
Date: Sat, 4 Nov 1995 19:58:32 GMT
Organization: Home
Sender: news@kroete2.freinet.de (news)
Message-ID: <DHJBHK.ILu@kroete2.freinet.de>
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch> <47eb7k$ckb@news.mel.aone.net.au>
Reply-To: ehcorry@inet.uni-c.dk (Erik Corry)
NNTP-Posting-Host: arhppp40.uni-c.dk
X-Newsreader: TIN [version 1.2 PL2]