Article View: comp.std.c
Article #3385Re: How to eliminate GOTO?
From: Christopher R. Volpe
Date: Mon, 28 Aug 1995 16:56
Date: Mon, 28 Aug 1995 16:56
36 lines
1935 bytes
1935 bytes
In article <41gnhu$qfj@eri2.erinet.com>, jab@PROBLEM_WITH_YOUR_MAIL_GATEWAY_FILE (Jerone A. Bowers) writes:
>halasz@caip.rutgers.edu 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;
>: }
>
>
> for(i=0;i<10;i++)
> for(j=0;j<10;j++)
> {
> /* some other code here to set condition */
> if(condition) goto iLoop;
> }
> iLoop:
> .....
>
>Pretty much the same thing are they not?
The two examples are the same, but the power of a goto (as it currently
exists) is not the same as the power of the proposed break. The proposed break
label is (or, appears to be) bound to a particular loop, and the compiler can
confirm that the break statement references a label bound to a loop within
which the break statement resides. This is more restrictive, and hence safer,
than the existing goto, which can branch to an arbitrary label. The ability to
use break in the above way would reduce the number of legitimately necessary
uses of a goto. The result of this would be to allow gotos to be used less
frequently.
--
Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D Fax: (518) 387-6560
PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<DE15qE.LEA@crdnns.crd.ge.com>Path:
arc1-ca.pugleaf.net!bart.crd.ge.com!volpeReferences:
<3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41gnhu$qfj@eri2.erinet.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c,comp.lang.c Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe From: volpe@bart.crd.ge.com (Christopher R. Volpe) Subject: Re: How to eliminate GOTO? Message-ID: <DE15qE.LEA@crdnns.crd.ge.com> Sender: volpe@bart (Christopher R. Volpe) Nntp-Posting-Host: bart.crd.ge.com Reply-To: volpe@ausable.crd.ge.com Organization: GE Corporate Research & Development References: <3vn1ht$kj8@martha.utk.edu> <41cke4$gtd@sparcserver.lrz-muenchen.de> <41glno$3a0@caip.rutgers.edu> <41gnhu$qfj@eri2.erinet.com> Date: Mon, 28 Aug 1995 16:56:38 GMT