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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,affd14e05b8fb09a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-28 20:01:27 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!border1.nntp.ash.giganews.com!nntp.giganews.com!local1.nntp.ash.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Wed, 28 Apr 2004 22:01:25 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: Subject: Re: Hierarchical States Machines Date: Wed, 28 Apr 2004 22:00:52 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: <25OdncWDToOY7Q3dRVn-hQ@megapath.net> NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-B6l90voh9KPTVy7rw+06eG4uWhM5wepQ9kE2CZNetilnZGW9zOeljycqHb1/DM7KO9vrjHdcZyVZ48I!KtnPGUM6dcb/RAhRo7FDSua8LDyP3YsM7ZeTgU65+dELCk8Cj5JlsaqBhZwRZ9GBSAMBwJ+TLrOa X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:7551 Date: 2004-04-28T22:00:52-05:00 List-Id: "Robert I. Eachus" wrote in message news:jrOdnQYzWKMxkQ3dRVn-hQ@comcast.com... > Incidentally, as far as I know, or for that matter most Ada experts > know, this is the only area in Ada where you should use gotos. But goto > has been kept in the language primarily because it is _necessary_ to > create maintainable finite state machines, push-down automata, and the like. Ah, baloney. :-) I use gotos whenever they prevent duplicating work that otherwise would have to be done. It's silly to have two copies of code to do something just to avoid a goto (or to make such code into a subprogram with no purpose other than to avoid a goto). A common case is to emulate the missing "continue" that Ada doesn't have. It usually shows up in some deeply nested code: loop if then goto Continue; end if; end if; ; <> null; end loop; You can avoid the goto by making a hash out of the code, but why bother? Gotos are efficient, not particularly unstructured in Ada (most of the bad cases are illegal) - compiler optimizers are unlikely to be able to get rid of batches of boolean flags and turn them into the branches that really were intended in the first place. Randy.