home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12938 < prev    next >
Encoding:
Text File  |  1992-08-26  |  2.9 KB  |  63 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 na
  5. Message-ID: <1992Aug26.215600.15114@mksol.dseg.ti.com>
  6. Organization: Texas Instruments Inc
  7. References: <714668024@thor> <6800007@tisdec.tis.tandy.com> <1992Aug26.130335.26725@hemlock.cray.com>
  8. Date: Wed, 26 Aug 1992 21:56:00 GMT
  9. Lines: 52
  10.  
  11. In <1992Aug26.130335.26725@hemlock.cray.com> dsf@cray.com (Dan Frankowski) writes:
  12.  
  13. >In article <6800007@tisdec.tis.tandy.com> kevinl@tisdec.tis.tandy.com writes:
  14.  
  15. >>    For experienced programmers, the goto is a legitamite tactic.
  16. >>There may not be any cases where a goto is absolutly necessary (I've
  17. >>heard that there are some, but I have yet to see any), ..
  18.  
  19. >I thought that one of the triumphs of the Structured Programming camp
  20. >was an honest-to-goodness proof that any code using gotos could be
  21. >replaced by structured constructs and state variables.  I can imagine
  22. >some such proof by construction from arbitrary code with a goto.
  23.  
  24. The fact that you CAN do something is not necessarily adequate proof
  25. that you SHOULD do something.  Yes, you can do anything you like with
  26. 'if-then' and 'while'.  Even structured programmers use other
  27. constructs than those.  You should use what makes things clearest, and
  28. yes, there are going to be times when 'goto' and 'break' make for
  29. cleaner and more easily read code.
  30.  
  31. >>    I agree that programs are generally easier to understand and
  32. >>debug when there are no goto statements, but, if well documented
  33. >>gotos are just another structured technique.
  34.  
  35. >If one-entry-one-exit is part of a structured programming, then the
  36. >goto is not "just another structured technique."  
  37.  
  38. I believe someone once wrote an article entitled something like
  39. "Structured Programming Using Goto"; the same person who wrote
  40. another article that started this whole mess that was entitled "Goto
  41. Considered Harmful", if my memory has changed state randomly.  In a
  42. nutshell, 'goto' isn't the problem; it's the 'come from' that kills
  43. you when it comes to figuring out what is going on.  If you structure
  44. things correctly and document them clearly, there are times when
  45. 'goto', 'break', AND multiple exits make good sense in making code
  46. more easily read.
  47.  
  48. >Note that I did not
  49. >say gotos have no uses.  (I haven't made up my mind yet.  Maybe this
  50. >thread will help me decide.  :-) However, they're not structured
  51. >programming, as defined by the debate in computer science fifteen-odd
  52. >years ago.
  53.  
  54. According to the guy who started that debate they are (if properly
  55. used). 
  56.  
  57.  
  58. -- 
  59. "Insisting on perfect safety is for people who don't have the balls to live
  60.  in the real world."   -- Mary Shafer, NASA Ames Dryden
  61. ------------------------------------------------------------------------------
  62. Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
  63.