home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!cs.utexas.edu!devnull!rgp
- From: rgp@mpd.tandem.com (Ramon Pantin)
- Newsgroups: comp.lang.c++
- Subject: Re: GOTO, was: Tiny proposal for na
- Message-ID: <2318@devnull.mpd.tandem.com>
- Date: 27 Aug 92 03:36:40 GMT
- References: <714668024@thor> <6800007@tisdec.tis.tandy.com> <rmartin.714863091@thor>
- Sender: news@devnull.mpd.tandem.com
- Organization: Tandem Computers, Micro-Products Division
- Lines: 44
-
- In article <rmartin.714863091@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
- >kevinl@tisdec.tis.tandy.com writes:
- >
- >| I have to paritally disagree. Everytime you add a flag variable,
- >|you are doubling the number of states for your program. The more states,
- >|the more possible paths, and the more paths, the more possible unforseen
- >|errors (if the paths are not anticipated and tested--something that is
- >|very hard to do).
- >
- >No, the influence of state variables which control loops is limitted
- >to the loop condition, and possibly to tests at the completion of the
- >loop. Thus, the "doubling" does not occur.
-
- It is well known that to rewrite code that uses breaks, continues,
- mid-function returns and gotos (in the most general case) you have to
- either:
- - Add state variables to the head of loops and additional tests
- of these variables within the bodies of the loops; or
- - State variables only tested at the head of the loops and
- code duplication.
-
- So you either duplicate code (as you did in the example a couple of
- postings ago) or you have to add additional tests within the loops
- (which I showed in my "structured" version of the original C example).
-
- So your wins are:
- - Code duplication, difficult to maintain (in one of your
- previous posts you din't even seem to agree that code
- duplication was difficult to maintain!); or
- - A complexity explosion in your code (number of code paths +
- tests and sets of state variables).
-
- From my informal counts in this thread it seems that most people are
- perfectly happy with break, continue and mid-function returns. Some
- group of people avoid gotos as a rule of thumb but wouldn't mind using
- them if required, some of these have not used a goto in the last 10 years.
- A smaller group (only you?) avoid all of these contructs completely.
-
- In any case Bob, nobody is suddenly going to have a religious experience
- right here and convert themselves to the other camp, so if you don't see
- more followups on this subject it is not because of that, but because this
- subject has already been beaten to death and at least I've got tired of it.
-
- Ramon Pantin
-