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

  1. Path: sparky!uunet!caen!kuhub.cc.ukans.edu!spssig.spss.com!hosken
  2. Newsgroups: comp.lang.c++
  3. Subject: Re: GOTO, was: Tiny proposal for na
  4. Message-ID: <1992Aug26.194538.1598@spss.com>
  5. From: hosken@spss.com (Bill Hosken)
  6. Date: Wed, 26 Aug 1992 19:45:38 GMT
  7. Sender: news@spss.com (Net News Admin)
  8. References: <714668024@thor> <6800007@tisdec.tis.tandy.com> <1992Aug26.130335.26725@hemlock.cray.com>
  9. Organization: SPSS, Inc.
  10. Lines: 26
  11.  
  12. >In article <1992Aug26.130335.26725@hemlock.cray.com>, dsf@cray.com (Dan Frankowski) writes:
  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.  
  25. It is easy to get rid of goto statements.  If you see goto a; just replace it by
  26. callGOTOa(); and then write a little subroutine that does the stuff at a:.
  27.  
  28. Now this introduces a lot of "recursion" into the program but the result has 
  29. no goto statements.  The resulting program will be more difficult to read and
  30. probably blow the stack limits, but what the heck.
  31.  
  32. Clear thinking helps to write good code, gotos whether or not.
  33.  
  34.  
  35. ___________________
  36.  
  37. Standard disclaimer.
  38.