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,a7f223906eb859a X-Google-Attributes: gid103376,public From: gauthier@alphainfo.unilim.fr (Michel Gauthier) Subject: Re: GOTO considered necessary Date: 1997/06/06 Message-ID: #1/1 X-Deja-AN: 246561120 References: <5n977i$2cmc$1@prime.imagin.net> Organization: Universite de Limoges Newsgroups: comp.lang.ada Date: 1997-06-06T00:00:00+00:00 List-Id: In article <5n977i$2cmc$1@prime.imagin.net>, smize@imagin.net (Samuel Mize) wrote: >> Greetings, >> >> I'm rebeating a dead horse, in order to write up a consensus paper to >> submit to adahome. I'll appreciate your input. >> This one concerns use of "goto" statements. >> [...] >> 3) Does this template reflect the design of a goto-based FSM, or have I >> missed something? Is there a better general approach? >> >> begin >> <> >> [ . . . ] -- The coder must ensure execution >> -- does not "fall through" to the >> -- next state by accident. >> >> <> >> ... It is probably advisable in such cases to use blocks and other protections in a spirit like : <> declare -- it is very rare to have no local variables begin ... end ; raise Program_Error ; <> ... Although style rules generally prohibit raising predefined exceptions, this might be a valid usage of Program_Error. Yet better : Ada.Exceptions.Raise_Exception(FSM_Exit_Error,"Bad exit of state X."); ---------- ---------- ---------- ---------- Michel Gauthier / Laboratoire d'informatique 123 avenue Albert Thomas / F-87060 Limoges telephone + 33 5 55 43 69 73 fax +33 5 55 43 69 77 ---------- ---------- ---------- ---------- Si l'an 2000 est pour vous un mysticisme stupide, utilisez la base 9 If you feel year 2000 a stupid mystic craze, use numeration base 9 ---------- ---------- ---------- ----------