Article View: comp.std.c
Article #3510Re: Multi-level break and elimination of GOTO
From: Lawrence Kirby
Date: Tue, 28 Nov 1995 13:58
Date: Tue, 28 Nov 1995 13:58
35 lines
1748 bytes
1748 bytes
In article <rnb3fb9ceap.fsf@euax7i3c01.eua.ericsson.se>
konfrbr@euax7i3c01.eua.ericsson.se "Fredrik Bredberg" writes:
>> But is it worth changing the language??
>
>No it's not!
>
>But
>
> do {
> stmt;
> while (cond) {
> stmt;
> if (cond)
> break label;
> stmt;
> }
> } while label (expr);
This thing I find unfortunate about this is that it is different from `for'
or `while' such that I can no longer tell whether to search forwards or
backwards from the break to find the target label. Certainly it would be
preferable from a scoping point of view that all such labels are declared
before prior to usage. That makes a compount statement label rather neat.
It may take a little more getting used to but I'm coming increasingly to
believe it is the most flexible and best choice. It means that the
enclising level you want to break out of must be expressed in terms of a
compount statement but generally that results in good coding style
anyway.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Technical Details
Message-ID:
<817567134snz@genesis.demon.co.uk>Path:
arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.ukReferences:
<486cj7$o4s@news.mel.aone.net.au> <rnb3fb9ceap.fsf@euax7i3c01.eua.ericsson.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk From: Lawrence Kirby <fred@genesis.demon.co.uk> Newsgroups: comp.std.c,comp.lang.c Subject: Re: Multi-level break and elimination of GOTO Date: Tue, 28 Nov 95 13:58:54 GMT Organization: none Message-ID: <817567134snz@genesis.demon.co.uk> References: <486cj7$o4s@news.mel.aone.net.au> <rnb3fb9ceap.fsf@euax7i3c01.eua.ericsson.se> Reply-To: fred@genesis.demon.co.uk X-NNTP-Posting-Host: genesis.demon.co.uk X-Newsreader: Demon Internet Simple News v1.27