home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!ames!pacbell.com!UB.com!igor!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Newsgroups: comp.lang.c++
- Subject: Re: GOTO, was: Tiny proposal for na
- Message-ID: <rmartin.715105486@thor>
- Date: 29 Aug 92 16:24:46 GMT
- 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>
- Sender: news@Rational.COM
- Lines: 32
-
- tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
-
- |In article <rmartin.714929724@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
-
- | Goto has never been a "good" way to implement FSMs. Nested
- | switch/case statements which use a State variable and transition codes
- | are more traditional, easier to maintain, and do not use goto.
-
- |That depends on your application. For the inner loop of a GC, an FSM
- |implemented with "goto" might be significantly faster than an FSM
- |implemented with state variables and transition codes.
-
- Agreed. And, as I have said before, if you have to break the rules to
- meet therequirements, then break the rules. If you absolutely need
- the speed (and in a GC subsystem you certainly do), and if you can
- gain that speed by using a few gotos, then use the gotos. Use breaks
- and continues and duplicated code and any other trick that will allow
- you to eek the last nanosecond out of your algorithms.
-
- But nanosecond preformance is not generally needed in most
- applications. And in those cases, (the general case) the payoff is
- greater if you sacrifice a little efficiency for readability,
- maintainability and resuability.
-
-
-
-
- --
- Robert Martin Training courses offered in:
- R. C. M. Consulting Object Oriented Analysis
- 2080 Cranbrook Rd. Object Oriented Design
- Green Oaks, Il 60048 (708) 918-1004 C++
-