home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12759 < prev    next >
Encoding:
Text File  |  1992-08-22  |  1.3 KB  |  36 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!uunet.ca!frumious!pat
  3. From: pat@frumious.uucp (Patrick Smith)
  4. Subject: Re: named loops
  5. Message-ID: <1992Aug22.031005.596@frumious.uucp>
  6. Date: Sat, 22 Aug 1992 03:10:05 GMT
  7. Reply-To: uunet.ca!frumious!pat
  8. References: <aldavi01.714376080@starbase.spd.louisville.edu> <1992Aug21.143653.10805@alias.com>
  9. Organization: None
  10. Lines: 24
  11.  
  12. Reid Ellis <rae@Alias.com> writes:
  13. |Arlie Davis <aldavi01@starbase.spd.louisville.edu> writes:
  14. ||for main_loop (...)
  15. ||  // ...
  16. ||  for inner_loop (...)
  17. ||    // ... complex mess of loops ...
  18. ||          break main_loop;       // somewhere deep inside the loops
  19. ||    // ...
  20. ||          continue inner_loop;   // similarly, deep inside loops
  21. |
  22. |How about an int argument to "break", as supported in many scripting
  23. |languages?  Add a similar argument to "continue" while we're at it.
  24.  
  25. I think the version with names would be clearer and less likely
  26. to cause errors in reading.  Imagine that the break statement is in
  27. the middle of one of those mammoth loops that contain 500 lines of
  28. code - can you be sure you've counted the nesting levels correctly
  29. so you know what the break is doing?  (Of course no one reading this
  30. writes loops like that :-), but we've all seen them, right?)
  31.  
  32. -- 
  33. Patrick Smith
  34. uunet.ca!frumious!pat
  35. pat%frumious.uucp@uunet.ca
  36.