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, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,68321983359cf306 X-Google-Attributes: gid103376,public From: linnig@ti.com (Mike linnig) Subject: Re: Use of 'goto' Date: 1997/06/20 Message-ID: #1/1 X-Deja-AN: 251327122 References: <01bc7c39$64813260$LocalHost@xhv46.dial.pipex.com> Organization: Texas Instruments Inc. Newsgroups: comp.lang.ada Date: 1997-06-20T00:00:00+00:00 List-Id: In article <01bc7c39$64813260$LocalHost@xhv46.dial.pipex.com>, "Nick Roberts" wrote: > > This is an extreme (and very rare) example. However, from years of > (sometimes bitter) experience programming 'in the field' on real programs, > I can put my hand on my heart and say that the humble goto comes in real > handy every so often. It is sometimes by far the neatest way to do it; it > is sometimes the only way to do it; it is sometimes the only way to replumb > a piece of code in five minutes when you've only got five minutes (on the > range, for example - boy could I tell some stories). Well after having been involved in a rewrite of our Ada coding standards I've come to the conclusion that people concentrate on things that are easy to detect. It is easy to detect the use of goto, it is quite visible, you can grep for it. Spagetti code is bad, spagetti code uses gotos, therefore goto is bad. Lots of things are bad in Ada. Global variables run amok is bad. Confusing variable name are bad. It is not always possible to define what is bad in a way that a non-programmer observer can detect it (SQE's, the boss). I think training is a better way to make good code than arbitrary restrictions on easy to notice features. In most environments, peer pressure will cause folks to move away from bad constructs if everyone has similar ideas on what is bad. Having said all that, our standards still restrict GOTO's, but we put in an escape clause that says that the team lead can override the standards if it is required. This raises the visibilty to the person responsible for getting the job done and 'teaches' the programmer that goto's are a construct that should not be used lightly. Regards, Mike Linnig +-----------------------------------------+ | Mike Linnig | | Phone: (972) 927-3469 | +-----------------------------------------+