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,99222a5bd46ef3c9 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: GOTO considered necessary (reworked) Date: 1997/06/13 Message-ID: #1/1 X-Deja-AN: 248316187 References: <5nn2fm$11dk$1@prime.imagin.net> <199706121410.QAA05823@basement.replay.com> <33A0840B.1B41@sprintmail.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-06-13T00:00:00+00:00 List-Id: In article <33A0840B.1B41@sprintmail.com>, John G. Volan wrote: >I agree with that philosophy, but I'd clarify it: Gotos may be used only >as a _last_ resort, after every other possible structure has been >exhaustively tried and still found to be less understandable, or >maintainable, or efficient, or whatever, than the proposed goto >solution. ... This seems like a strange attitude to me. I mean, why not say the same thing about any other language feature, like if statements? You shouldn't use an if statement if there is another way of writing the code that's more understandable, maintainable, or whatever. The same applies to goto. Why does that make goto a "last resort"? I certainly agree that there are lots more cases where if statements are appropriate than cases where goto is appropriate. But both can be judged according to the same criteria -- as you said, "understandable, or maintainable, or efficient, or whatever". I would also agree, if you said, "As a rule of thumb, if you think you want to use a goto, think twice." >... But this is a very stringent requirement, and I expect it >will be very rare that a goto solution will beat out all other >alternatives. And everybody seems to agree with *that*. By the way, for most programs, it seems far more important to worry about how you structure the thing using packages, types, subprograms, tasks, etc, than to worry about the control structures. Usually the control structures are so small (within a single subprogram), that even if you *only* used goto for control flow (which I don't recommend, of course!) you could still understand the program. - Bob