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: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: Jonathan Guthrie Subject: Re: Software landmines (was: Why C++ is successful) Date: 1998/09/06 Message-ID: <6ssula$357$1@news.hal-pc.org>#1/1 X-Deja-AN: 388314518 References: <35cb8058.645630787@news.ne.mediaone.net> <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> <6r1glm$bvh$1@nnrp1.dejanews.com> <6r9f8h$jtm$1@nnrp1.dejanews.com> <6renh8$ga7$1@nnrp1.dejanews.com> <6rf59b$2ud$1@nnrp1.dejanews.com> Organization: Information Broker Systems Internet Services Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-06T00:00:00+00:00 List-Id: In comp.lang.ada Matthew Heaney wrote: > I routinely use gotos to implement tasks. Tasks usually execute a state > machine, and gotos are the most natural way to implement the jumping > between states that is required. I have seen the assertion made that gotos are a natural way of handling FSM's, and I have to mildly disagree with that statement. I'm working on an industrial control system (well, it's industrial-style--- the system itself is intended to be installed at the fuelling positions in automotive service stations) which consists of something like 2 dozen programs running on 1+2N computers (where 'N' is the number of fuelling positions) written in (so far) four different programming languages and running under three different operating systems. The set up is absolutely lousy with FSMs, but I can't use the PC to encode the state because those programs that have FSMs have more than one. (The least I have in any is in the DS-5000 source, which has 3 FSMs in about 2000 lines of BASIC.) I can't encode the state in the PC because I know of no way of doing that (short of merging all of the state machines, which is not possible due to memory constraints) when multiple independant finite state machines exist in the same program. I think I understand how to use it in scanners, though. I hadn't realized that it isn't necessary to save the state of the scanner (with the possible exception of lookahead characters) when the scanner isn't active. I would have to check my sources to see if I've already built that assumption in to my code. (I'd be willing to bet that I have. That seems to be the difference between the FSMs I usually write and those independant ones I've been building for Additech.) Anyway, I would have to say that gotos are a natural way of handling some FSMs, but not all. -- Jonathan Guthrie (jguthrie@brokersys.com) Information Broker Systems +281-895-8101 http://www.brokersys.com/ 12703 Veterans Memorial #106, Houston, TX 77014, USA We sell Internet access and commercial Web space. We also are general network consultants in the greater Houston area.