🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3466

Re: Multi-level break and elimination of GOTO

#3466
From: Andrew Dunbar
Date: Thu, 09 Nov 1995 06:38
36 lines
1367 bytes
Fredrik Bredberg (konfrbr@euax7i3c01.eua.ericsson.se) wrote:
: 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);
: :    }
: : }
: 
: I think that Andrew's `named' loops is the best alternative to this
: problem that I'v seen so far! The main reason for this is that the
: `label' is so closely coupled to the loop constructor.
: 

Thanks for the support!
The only problem I can see is for do loops:

do
{
    while inner (exp1)
    {
        if (exp2)
            break outer;
    }
} while outer;

Not as pretty is it? But then again do loops never were as nice as the
others.

Andrew Dunbar
GPSoftware
Technical Details
Message-ID: <47s7l0$r18@news.mel.aone.net.au>
Path: arc1-ca.pugleaf.net!news.mel.aone.net.au!not-for-mail
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mel.aone.net.au!not-for-mail
From: andrewd@agnus.livewire.com.au (Andrew Dunbar)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Multi-level break and elimination of GOTO
Followup-To: comp.std.c,comp.lang.c
Date: 9 Nov 1995 06:38:24 GMT
Organization: Livewire Communications
Message-ID: <47s7l0$r18@news.mel.aone.net.au>
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch>
NNTP-Posting-Host: agnus.livewire.com.au
X-Newsreader: TIN [UNIX 1.3 950515BETA PL0]