home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12870 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  1.4 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!rpi!usc!sol.ctr.columbia.edu!eff!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
  2. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: GOTO, was: Tiny proposal for named loops.
  5. Message-ID: <TMB.92Aug25220434@arolla.idiap.ch>
  6. Date: 26 Aug 92 02:04:34 GMT
  7. References: <TSOS.61.714395736@uni-duesseldorf.de> <1992Aug21.203635.2917@alias.com>
  8.     <rmartin.714668024@thor> <2299@devnull.mpd.tandem.com>
  9.     <rmartin.714749390@thor>
  10. Sender: news@ai.mit.edu
  11. Reply-To: tmb@idiap.ch
  12. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  13.     Perceptive)
  14. Lines: 17
  15. In-reply-to: rmartin@thor.Rational.COM's message of 25 Aug 92 13:29:50 GMT
  16.  
  17. After many postings extolling the evils of "break", "return" and other
  18. "non-structured" exits from blocks, Bob Martin writes in article
  19. <rmartin.714749390@thor>:
  20.  
  21.    In a real application, when confronted with memory outage, I would
  22.    throw an exception, call assert, or just plain exit.
  23.  
  24. What is an exception exception other than an exit from a block? How is
  25. that going to leave your "pre- and postconditions" intact?
  26.  
  27. Altogether, I find Bob's arguments against "break" unconvincing. There
  28. is nothing wrong with using "break", exceptions, or even the
  29. occasional "goto" in C++, since C++ has mechanisms (destructors) that
  30. can be used to take care of cleanup jobs when a block is exited from
  31. anywhere; simply use them.
  32.  
  33.                     Thomas.
  34.