home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13546 < prev    next >
Encoding:
Text File  |  1992-09-11  |  2.5 KB  |  50 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
  3. From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
  4. Subject: Re: GOTO, was: Tiny proposal for named loops.
  5. Message-ID: <1992Sep11.184207.15187@mksol.dseg.ti.com>
  6. Organization: Texas Instruments Inc
  7. References: <2318@devnull.mpd.tandem.com> <rmartin.715001372@thor> <4192@papaya.bbn.com> <1992Sep2.131733.20676@terminator.cc.umich.edu> <r <KERS.92Sep4082931@cdollin.hpl.hp.com> <rmartin.715618743@thor> <1992Sep9.210632.25891@mksol.dseg.ti.com> <rmartin.716170143@thor>
  8. Date: Fri, 11 Sep 1992 18:42:07 GMT
  9. Lines: 39
  10.  
  11. In <rmartin.716170143@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  12.  
  13. >mccall@mksol.dseg.ti.com (fred j mccall 575-3539) writes:
  14.  
  15. >|In <rmartin.715618743@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  16.  
  17. >|Sorry, but that's hardly the reason.  Where is the 'coupling' or the
  18. >|difficulty in maintenance when goto is used for things like error
  19. >|handling or error returns? 
  20.  
  21. >The coupling is between the error condition, and the error processing.
  22. >The error processing control flow is merged with the separate control
  23. >flows which detect the error.  
  24.  
  25. And just how, pray tell, do you recover from an error WITHOUT coupling
  26. between the error condition and the error processing, since what error
  27. processing you need to do is most certainly going to be dependent on
  28. what your error condition is?
  29.  
  30. >These merged control flows get difficult to maintain over time,
  31. >because new error conditions arise which need to be handled in almost
  32. >the same way, but with a few exceptions.  These exceptions accumulate
  33. >in the merged code, and it eventually turns into a nightmare until
  34. >someone undoes all the gotos and separates all the error processing.
  35.  
  36. So instead you do WHAT?  I don't see any better solution, other than
  37. duplicating huge blocks of code to do error handling at each test on
  38. the way through the code (in the other arm of the 'if').  If you are
  39. also following another one of those guides that often becomes a goal
  40. in itself (function size limits) you rapidly reach the point (with all
  41. that duplicated code for error handling) where you can no longer even
  42. write the function.  There's another one of those rules (depth of
  43. nesting) that will 'kill' your method, as well.
  44.  
  45. -- 
  46. "Insisting on perfect safety is for people who don't have the balls to live
  47.  in the real world."   -- Mary Shafer, NASA Ames Dryden
  48. ------------------------------------------------------------------------------
  49. Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
  50.