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

  1. Path: sparky!uunet!sun-barr!ames!pacbell.com!UB.com!igor!thor!rmartin
  2. From: rmartin@thor.Rational.COM (Bob Martin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: GOTO, was: Tiny proposal for na
  5. Message-ID: <rmartin.715105486@thor>
  6. Date: 29 Aug 92 16:24:46 GMT
  7. References: <714668024@thor> <6800007@tisdec.tis.tandy.com>     <1992Aug26.130335.26725@hemlock.cray.com>     <MATT.92Aug26122422@physics16.berkeley.edu> <rmartin.714929724@thor> <TMB.92Aug28192826@arolla.idiap.ch>
  8. Sender: news@Rational.COM
  9. Lines: 32
  10.  
  11. tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
  12.  
  13. |In article <rmartin.714929724@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  14.  
  15. |   Goto has never been a "good" way to implement FSMs.  Nested
  16. |   switch/case statements which use a State variable and transition codes
  17. |   are more traditional, easier to maintain, and do not use goto.
  18.  
  19. |That depends on your application. For the inner loop of a GC, an FSM
  20. |implemented with "goto" might be significantly faster than an FSM
  21. |implemented with state variables and transition codes.
  22.  
  23. Agreed.  And, as I have said before, if you have to break the rules to
  24. meet therequirements, then break the rules.  If you absolutely need
  25. the speed (and in a GC subsystem you certainly do), and if you can
  26. gain that speed by using a few gotos, then use the gotos.  Use breaks
  27. and continues and duplicated code and any other trick that will allow
  28. you to eek the last nanosecond out of your algorithms.
  29.  
  30. But nanosecond preformance is not generally needed in most
  31. applications.  And in those cases, (the general case) the payoff is
  32. greater if you sacrifice a little efficiency for readability,
  33. maintainability and resuability.
  34.  
  35.  
  36.  
  37.  
  38. --
  39. Robert Martin                        Training courses offered in:
  40. R. C. M. Consulting                       Object Oriented Analysis
  41. 2080 Cranbrook Rd.                        Object Oriented Design
  42. Green Oaks, Il 60048 (708) 918-1004       C++
  43.