From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,86fd56abf3579c34 X-Google-Attributes: gid103376,public From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: State machines and Goto's (was Re: Should internet support software be written in Ada?) Date: 1995/04/19 Message-ID: <9511002.21479@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 101283231 sender: news@cs.mu.OZ.AU (CS-Usenet) references: <3kaksj$iur@isnews.calpoly.edu> <3ki9t8$c8l@Starbase.NeoSoft.COM> <3m3j73$php@tali.hsc.colorado.edu> <1995Apr7.141054.17419@sei.cmu.edu> organization: Computer Science, University of Melbourne, Australia newsgroups: comp.lang.ada Date: 1995-04-19T00:00:00+00:00 List-Id: ka@socrates.hr.att.com (Kenneth Almquist) writes: >firth@sei.cmu.edu (Robert Firth) writes: >> X.Y.Z.2: a goto statement shall not be used merely to avoid the >> replication of code. Example: >> >> when '+' => >> sign := positive; >> goto get_rest_of_number; >> when '-' => >> sign := negative; >> goto get_rest_of_number; >> ... > >No, No, No, No, No!!!!!!! > >Sorry if this is somewhat heated, but every time you replicate code you are >creating a potential maintainance headache that *somebody* is going to have >to deal with. The alternative should not be to replicate the code, it should be to put the common code into a procedure or function. when '+' => get_rest_of_number(sign => positive); when '-' => get_rest_of_number(sign => positive); -- Fergus Henderson | As practiced by computer science, the study of fjh@cs.mu.oz.au | programming is an unholy mixture of mathematics, http://www.cs.mu.oz.au/~fjh | literary criticism, and folklore. - B. A. Sheil