home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!uunet.ca!frumious!pat
- From: pat@frumious.uucp (Patrick Smith)
- Subject: Re: named loops
- Message-ID: <1992Aug22.031005.596@frumious.uucp>
- Date: Sat, 22 Aug 1992 03:10:05 GMT
- Reply-To: uunet.ca!frumious!pat
- References: <aldavi01.714376080@starbase.spd.louisville.edu> <1992Aug21.143653.10805@alias.com>
- Organization: None
- Lines: 24
-
- Reid Ellis <rae@Alias.com> writes:
- |Arlie Davis <aldavi01@starbase.spd.louisville.edu> writes:
- ||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
- |
- |How about an int argument to "break", as supported in many scripting
- |languages? Add a similar argument to "continue" while we're at it.
-
- I think the version with names would be clearer and less likely
- to cause errors in reading. Imagine that the break statement is in
- the middle of one of those mammoth loops that contain 500 lines of
- code - can you be sure you've counted the nesting levels correctly
- so you know what the break is doing? (Of course no one reading this
- writes loops like that :-), but we've all seen them, right?)
-
- --
- Patrick Smith
- uunet.ca!frumious!pat
- pat%frumious.uucp@uunet.ca
-