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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf677878aa77e0d8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-17 12:25:32 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <3B4F2962.25BB60FF@boeing.com> <3B4F758B.197CA145@boeing.com> <9iv0ce$3d3$1@nh.pace.co.uk> <3B546F9D.4030809@gmx.net> <9j1u8a$863$1@nh.pace.co.uk> Subject: Re: an infinate loop Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Tue, 17 Jul 2001 15:25:23 EDT Organization: http://www.newsranger.com Date: Tue, 17 Jul 2001 19:25:23 GMT Xref: archiver1.google.com comp.lang.ada:10091 Date: 2001-07-17T19:25:23+00:00 List-Id: In article <9j1u8a$863$1@nh.pace.co.uk>, Marin David Condic says... > >I have not used a goto in any language since at least 1983 - maybe longer, Before this year, I hadn't used one since I quit using BASIC 16 years ago. I had an occasion to write a small lexer in C (the classic "state machine" app), so I tried it out that way. I have to say that the result wasn't pretty. However, the alternatives; using a huge multiply nested "if", or a "switch" in a loop with an enumeration designating the state, would have been just as ugly, and would have taken more CPU to achieve that equal uglyness. I could easily see where someone familar with reading state machine code could make a case that the goto version was indeed easier to read, but it still wasn't as readable as I generally like to see my code be. I think the basic problem is that state-machine control flow itself is ugly, and there just is no pretty way to show it. So while I can't agree that "goto" inarguably makes this particular algorithm look better, it at least doesn't make it worse, and it performs it slightly quicker. I'm not sure that would normally be enough to justify its inclusion in the language. However, I'd observe that this issue comes up a lot more for compiler writers than for the rest of us, and compiler writers did create this language. :-) --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com