home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:11556 comp.lang.c++:11467
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!uka!i41s14!prechelt
- From: prechelt@i41s14.ira.uka.de (Lutz Prechelt)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: exit many loops at once (was: Pascal vs C)
- Date: 24 Jul 1992 12:33:18 GMT
- Organization: University of Karlsruhe, FRG
- Lines: 38
- Distribution: world
- Message-ID: <14otaeINNqoh@iraul1.ira.uka.de>
- References: <1992Jun13.152010.15968@aplcen.apl.jhu.edu> <1992Jun13.220259.17547@beaver.cs.washington.edu> <1992Jul22.201454.26298@microsoft.com>
- NNTP-Posting-Host: i41s14.ira.uka.de
- Keywords: refinements, goto, leave, break
-
- In article <1992Jul22.201454.26298@microsoft.com>, philco@microsoft.com (Phillip Cooper) writes:
- |> In article <1992Jun13.220259.17547@beaver.cs.washington.edu> andrewb@lynx.cs.washington.edu (Andrew Berg) writes:
- |> >ded@aplcen.apl.jhu.edu (nod sivad) writes:
- |> >: >You can use "goto" e.g.
- |> >: >
- |> >: >{
- |> >: > for(...) {
- |> >: > for(...) {
- |> >: > if(...) goto exloop;
- |> >: > }
- |> >: > }
- |> >: >exloop:
- |> >: >}
- |> >: >
- |> >: >Sure, it is not a very good style, but is should work.
-
- Hmm. The style can be improved by using refinements:
- Put all three loops into one refinement called "threeloops" and replace
- the goto by
- leave `threeloops;
- This is structured and is just a generalization of
- break;
-
- The C-Refine preprocessor that introduces refinements into C or C++
- is available for anonymous ftp from
- iraun1.ira.uka.de [129.13.10.90]
- /pub/gnu/crefine.3.0.tar.Z
-
- It also appeared on comp.sources.reviewed as v02i013 to v02i19
- on July 15th, 1992
-
- Lutz
-
- --
- Lutz Prechelt (email: prechelt@ira.uka.de) | Whenever you
- Institut fuer Programmstrukturen und Datenorganisation | complicate things,
- Universitaet Karlsruhe; D-7500 Karlsruhe 1; Germany | they get
- (Voice: ++49/721/608-4317, FAX: ++49/721/694092) | less simple.
-