Path: utzoo!attcan!ncrcan!becker!censor!comspec!tvcent!lethe!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!helios!stat.tamu.edu From: richard@stat.tamu.edu (richard.henderson~) Newsgroups: comp.lang.c Subject: Re: Goto or not goto? (Was: Re: loops in general) Keywords: goto state-machine Message-ID: <5249@helios.TAMU.EDU> Date: 7 May 90 09:30:34 GMT References: <2106@l.cc.purdue.edu> <12866@ulysses.att.com> <2296@awdprime.UUCP> Sender: usenet@helios.TAMU.EDU Organization: Campus Crusade for Cthulhu, TAMU CS dept. Lines: 25 In article <2296@awdprime.UUCP> cs.utexas.edu!auschs!ibmaus!commlab1.austin.ibm.com!tif writes: >In article <12866@ulysses.att.com> ggs@ulysses.att.com (Griff Smith) writes: > [ Some neat defines and a little state machine deleted ] After I saw this, I could not help but see what would happen, so I wrote out a small state machine that matched (ab|c)*d. It turned out to produce 25% fewer lines of machine code under both cc (88 vs 120) and gcc (74 vs 98) on a sun3. And this seems right. If I were to hand code a state machine, it would have spaghetti jumps too. I cannot see anything wrong with compiling with DEBUG to make sure that it works, then turning it off. Especially if it can speed up a simple pattern match on /usr/dict/words by over 1 second. >Paul Chamberlain >tif@doorstop.austin.ibm.com >tif@commlab1.austin.ibm.com >sc30661@ausvm6 richard~ /* richard@csseq.tamu.edu richard@stat.tamu.edu */