Article View: comp.std.c
Article #3918Re: How to eliminate GOTO?
From: halasz
Date: Mon, 04 Sep 1995 16:34
Date: Mon, 04 Sep 1995 16:34
31 lines
1604 bytes
1604 bytes
In article <42f8n4$eq1@caip.rutgers.edu>, halasz@caip.rutgers.edu writes:
In article <42bjpc$lum@yage.tembel.org>, shields@tembel.org (Michael Shields) writes:
> But that would be the same as goto, plus a suffix.
"suffix"?
> The potential for abuse is obvious; can you give an example
> where it would make code much clearer?
(the strange new token is onlie for distinction from "goto"-label):
search:: while (1) {
...
while (1) {
...
break search;
}
}
The syntactic distinction makes "goto" not work for this label. Furthermore,
this label is known onlie within the loop, and use of it on another loop is
valid. Therefore, one knows where "break"s and "continue"s that refer to
this label can be.
Another form was suggested:
while search: (1) { ... }
. This is good, except for "do ... while (...);".
A third scheme occurs to me:
1: So leav all labels as thei are, and let "break"/"continue" uze them,
2: but forbid sharing of labels between "goto" and the rest.
3: Allou a new construct for labels onlie for "goto",
label <label>;
with a view to changing the meaning of label with colon, for use
onlie by "break"/"continue".
Technical Details
Message-ID:
<42f9qd$f66@caip.rutgers.edu>Path:
arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mailReferences:
<41cke4$gtd@sparcserver.lrz-muenchen.de> <41ni1c$ft6@news1.wolfe.net> <42f8n4$eq1@caip.rutgers.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mail From: halasz@caip.rutgers.edu Newsgroups: comp.std.c Subject: Re: How to eliminate GOTO? Date: 4 Sep 1995 12:34:21 -0400 Organization: Rutgers University Message-ID: <42f9qd$f66@caip.rutgers.edu> References: <41cke4$gtd@sparcserver.lrz-muenchen.de> <41ni1c$ft6@news1.wolfe.net> <42f8n4$eq1@caip.rutgers.edu> NNTP-Posting-Host: caip.rutgers.edu