Article View: comp.std.c
Article #4032Re: Situation indicators (long) (was: How to eliminate GOTO?)
From: Paul Long
Date: Mon, 18 Sep 1995 18:16
Date: Mon, 18 Sep 1995 18:16
55 lines
3175 bytes
3175 bytes
guenther@gac.edu (Philip Guenther) wrote:
>(Can you keep your lines to ~70 characters instead of 80? Thanks)
(Netscape Navigator wraps it there. I'll try to find out how to convince it
otherwise. Thanks.)
>I actually like the looks of the until...then syntax. Yes, it's
>syntactic sugar. So's most the rest of C or any other language. I
>like it because it's a relatively clear method for describing a
>many->many flow control, as opposed to a combination of the one->many
>'if' and many->one 'break' and 'goto'.
Whoa, someone who really likes it!
>while until..then is rather
>easily analyzed at compile time, though it could really make
>optimization (flow analysis in particular) difficult.
Situation indicators should present no new problems. They are functionally
identical to the break and goto statements. However, because they are debatably
easier to use, they might be used more often than break and goto, and that
would circumvent fruitful flow analysis.
>Of course, if the basic until...then syntax was in standard C, passing
>arguments to the indicators would be a gcc extension. :-)
Situation indicators or any of the other proposed solutions have zero
chance of making it into the Standard. A langauge-standards body should
not invent language features--it should _standardize_ existing art (hear
that, C++ committee?). Languages such as Gnu C/C++ are where such
features should be tried out first.
>This actually wouldn't be particularly more difficult to implement
>than the basic syntax. It's much closer to initialized local
>variables then a function call.
Yeah, I see what you mean. But then what do we do about a prototype for
the then-clause function? Do we use K&R rules for argument promotion or
do we add even more to the grammar for then-clause prototypes? Yucko.
>I think until...then is very close to the spirit of the
>language (it's not a leap in paradigm), and that it could improve
>legibilty of many pieces of code, if just in it's "local error
>handler" usage.
I agree. I think that, IMHO, of the proposed solutions, situation
indicators are the simplest and most elegant solution to both the
leave-nested-loop and structured-goto "problems." But then I would,
wouldn't I? :-)
--
Paul Long 45:29:14N 122:48:09W
plong@perf.com http://www.teleport.com/~pciwww/
"Where time or intelligence are lacking, a goto may do the job."
- M.E. Hopkins, "A Case for the GOTO," 1972.
Technical Details
Message-ID:
<43kd1i$ntr@news0.rain.rg.net>Path:
arc1-ca.pugleaf.net!usenet.eel.ufl.edu!pacifier!rainrgnews0!usenetReferences:
<4321kd$cne@news0.rain.rg.net> <GUENTHER.95Sep13001250@lunen.gac.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!usenet.eel.ufl.edu!pacifier!rainrgnews0!usenet From: Paul Long <plong@perf.com> Newsgroups: comp.std.c Subject: Re: Situation indicators (long) (was: How to eliminate GOTO?) Date: 18 Sep 1995 18:16:18 GMT Organization: Performance Computing Incorporated Message-ID: <43kd1i$ntr@news0.rain.rg.net> References: <4321kd$cne@news0.rain.rg.net> <GUENTHER.95Sep13001250@lunen.gac.edu> NNTP-Posting-Host: yosemite.perf.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.1 sun4c) X-URL: news:GUENTHER.95Sep13001250@lunen.gac.edu