Article View: comp.std.c
Article #3379Re: How to eliminate GOTO?
From: Jerone A. Bowers
Date: Sat, 26 Aug 1995 13:04
Date: Sat, 26 Aug 1995 13:04
38 lines
1889 bytes
1889 bytes
Tony Hawkins (hawkins@PROBLEM_WITH_INEWS_GATEWAY_FILE) wrote:
: iLoop: for(i=0;i<10;i++)
: for(j=0;j<10;j++){
: /* some other code here to set condition */
: if(condition) break iLoop;
: }
The for loop is going to execute again unless i >= 10
:
:
: > for(i=0;i<10;i++)
: > for(j=0;j<10;j++)
: > {
: > /* some other code here to set condition */
: > if(condition) goto iLoop;
: > }
: > iLoop:
: > .....
The for loop is not going to execute here no matter what i is.
I understand what you are saying about "break loopi". It would be
an interesting construct indeed. At the risk of being 0 and
branded a heretic I think the real problem with goto is that we are
taught that goto is evil, so we never believe that a goto would
be the best choice for a particular construct. I know that purists
are going to scream that rethinking the construct and the goto could
be eliminated. This is true but in the "real world" it is not
always possible and/or practical.
--
These thoughts are mine and mine alone. I can say that, right?
EMAIL: jab@bowtech.erinet.com | Tomorrow is not to be
SMAIL 9221 N Main St | feared. It will pass.
Dayton, OH 45415-1126 |
Technical Details
Message-ID:
<41n64n$26v@eri2.erinet.com>Path:
arc1-ca.pugleaf.net!news.erinet.com!not-for-mailReferences:
<3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41gnhu$qfj@eri2.erinet.com> <41hsls$or@aadt.sdt.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.erinet.com!not-for-mail From: jab@PROBLEM_WITH_YOUR_MAIL_GATEWAY_FILE (Jerone A. Bowers) Newsgroups: comp.std.c,comp.lang.c Subject: Re: How to eliminate GOTO? Followup-To: comp.std.c,comp.lang.c Date: 26 Aug 1995 13:04:23 GMT Organization: BowTech Message-ID: <41n64n$26v@eri2.erinet.com> References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41gnhu$qfj@eri2.erinet.com> <41hsls$or@aadt.sdt.com> NNTP-Posting-Host: bowtech.erinet.com X-Newsreader: TIN [UNIX 1.3 950515BETA PL0]