home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!swrinde!mips!darwin.sura.net!ukma!vlsi!starbase.spd.louisville.edu!aldavi01
- From: aldavi01@starbase.spd.louisville.edu (Arlie Davis)
- Newsgroups: comp.lang.c++
- Subject: Tiny proposal for named loops.
- Message-ID: <aldavi01.714376080@starbase.spd.louisville.edu>
- Date: 21 Aug 92 05:48:00 GMT
- Sender: news@vlsi.louisville.edu (Network News System)
- Organization: University of Louisville
- Lines: 28
- Nntp-Posting-Host: starbase.spd.louisville.edu
-
- Since the language is still open to improvements, even those which relate to
- the more C-oriented personality of C++, I'd like to suggest the addition
- of named loops. The syntax would not break any existing code at all.
- An identifier would be placed just after the "for", "while", "do", or even
- "if" keyword. This keyword could be used just after "break" or "continue",
- to specify exactly which loop to break or continue.
-
- Example:
-
- for main_loop (...)
- // ...
- for inner_loop (...)
- // ... complex mess of loops ...
- break main_loop; // somewhere deep inside the loops
- // ...
- continue inner_loop; // similarly, deep inside loops
-
-
- This would eliminate the need for some state variables used with switches,
- which would make code more readable, and more block-oriented.
-
- Yes, it's a structured goto. But so are break and continue in the first place
- -- this is an improvement of them.
-
- Any comments in email, please.
-
- --
- lrwx------ 1 aldavi01 emacsstu 9 Jun 6 12:43 .signature -> /dev/null
-