🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3468

Re: Multi-level break and elimination of GOTO

#3468
From: William Hutto
Date: Fri, 10 Nov 1995 12:04
48 lines
2432 bytes
In article <DHpCK1.HyG@kroete2.freinet.de>,
   erik@kroete2.freinet.de (Erik Corry) wrote:
>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.
>
>What I think is wrong with 'named loops':
>
>1) It's a completely new syntax for C. This makes learning it difficult.
>2) It's a completely new syntax for C. This makes parsing it difficult.
>   Specifically it looks like a function call inner() yet it is actually
>   a label. Major grief for the lexer/parser interface. So at a minmum
>   there should be a ':' after the label to help the lexer. If you
>   do that why not swap the order of the label and the for/while token
>   and do it like Java!
>3) It gains us virtually nothing. Remember we can't get rid of goto!
>   So we are introducing a new construct that duplicates things that
>   can be done with goto.
>
>The only benefit would be better error checking, because 'break <label>'
>can be used in fewer situations than 'goto <label>'. But what sort of
>errors can we catch with this construct?
>
>1) Do it like Java.
>2) Leave it as it is.
>

I say leave it like it is. I've used goto only once in all my source code. I 
know why I used it, where I used it, and what file it's in. Proper ettiquette 
is important where cleanliness and social acceptance are concerned. But let's 
face it, "sometimes, the best way to get rid of a booger is to pick your 
nose."

Bill
Technical Details
Message-ID: <47vf3u$12do@news.gate.net>
Path: arc1-ca.pugleaf.net!gate.net!pslfl2-37
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch> <rnbohuqj8p3.fsf@euax7i3c01.eua.ericsson.se> <DHpCK1.HyG@kroete2.freinet.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gate.net!pslfl2-37
From: bhutto@gate.net (William Hutto)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Multi-level break and elimination of GOTO
Date: 10 Nov 1995 12:04:14 GMT
Organization: CyberGate
Message-ID: <47vf3u$12do@news.gate.net>
References: <43pdut$hoh@galaxy.csc.calpoly.edu> <DF8FE3.97H@news.cern.ch> <rnbohuqj8p3.fsf@euax7i3c01.eua.ericsson.se> <DHpCK1.HyG@kroete2.freinet.de>
NNTP-Posting-Host: pslfl2-37.gate.net
X-Newsreader: News Xpress Version 1.0 Beta #4