home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13158 < prev    next >
Encoding:
Text File  |  1992-09-01  |  2.2 KB  |  44 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!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 na
  5. Message-ID: <1992Sep1.192043.16224@mksol.dseg.ti.com>
  6. Organization: Texas Instruments Inc
  7. References: <714668024@thor> <6800007@tisdec.tis.tandy.com> <1992Aug26.130335.26725@hemlock.cray.com> <1992Aug26.194538.1598@spss.com> <rmartin.714931485@thor>
  8. Date: Tue, 1 Sep 1992 19:20:43 GMT
  9. Lines: 33
  10.  
  11. In <rmartin.714931485@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  12.  
  13. >So we have rules.  These rules protect us average types from the guys
  14. >who think they are "real good drivers".  When some guy blows a stop
  15. >sign, it doesn't matter to me, one whit, if he is the greatest driver
  16. >in the world, I will still applaud the cop who pulls him over.
  17.  
  18. But the problem is that, all too often, we lose sight of what we
  19. wanted the rule to do for us and the means BECOMES the goal.  I've
  20. seen this more times than I care to mention when it comes to 'rules'
  21. and their 'enforcement'.
  22.  
  23. The real rule on 'goto' ought to be something like, "Presence of a
  24. goto in code MAY indicate poorly structured and/or overly complex
  25. code.  Any use of a goto should be carefully examined to determine if
  26. there are not better alternative structures which will be more easily
  27. understood and maintained by others.  If, and only if, this is the
  28. case, use a 'goto'."  Clearly document the purpose and effect of the
  29. jump at both the 'goto' and 'label'.  Avoid jumps from different
  30. places to the same label.  Similar rules for various other
  31. 'questionable' or 'abused' constructs.
  32.  
  33. The argument, "Well, you never NEED to use a goto." is hardly a
  34. justification for not using them, either.  You can also write
  35. everything in the world (wrt 'structure') with only a conditional test
  36. and a jump.  That's hardly a good reason to say that you SHOULD.
  37.  
  38.  
  39. -- 
  40. "Insisting on perfect safety is for people who don't have the balls to live
  41.  in the real world."   -- Mary Shafer, NASA Ames Dryden
  42. ------------------------------------------------------------------------------
  43. Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
  44.