comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: an infinate loop
Date: Tue, 17 Jul 2001 19:25:23 GMT
Date: 2001-07-17T19:25:23+00:00	[thread overview]
Message-ID: <Di057.22614$Kf3.297841@www.newsranger.com> (raw)
In-Reply-To: 9j1u8a$863$1@nh.pace.co.uk

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



  reply	other threads:[~2001-07-17 19:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12 21:43 an infinate loop Beau
2001-07-13  3:21 ` DuckE
2001-07-13 13:57 ` Ted Dennison
2001-07-13 17:01   ` Jeffrey Carter
2001-07-13 18:11     ` Ted Dennison
2001-07-13 22:26       ` Jeffrey Carter
2001-07-16 15:14         ` Marin David Condic
2001-07-17 17:02           ` Matthias Kretschmer
2001-07-17 17:56             ` Marin David Condic
2001-07-17 19:25               ` Ted Dennison [this message]
2001-07-19 11:38                 ` Matthias Kretschmer
2001-07-19 14:28                   ` Ted Dennison
2001-07-17 17:13           ` Warren W. Gay VE3WWG
2001-07-14 23:41       ` Darren New
2001-07-16 13:24         ` Ted Dennison
2001-07-16 15:19           ` Marin David Condic
2001-07-13 20:40     ` chris.danx
2001-07-13 22:29       ` Jeffrey Carter
2001-07-14 14:00         ` Robert Dewar
2001-07-14 16:17           ` Negative Logic (was: Re: an infinate loop) Jeffrey Carter
2001-07-17  4:06             ` Robert Dewar
2001-07-17  4:23             ` Robert Dewar
2001-07-16  9:26           ` an infinate loop Philip Anderson
2001-07-19  9:32             ` an infinite [was: infinate] loop AG
2001-07-15 21:18   ` an infinate loop Matthias Kretschmer
2001-07-16 21:59   ` Stephen Leake
2001-07-13 16:48 ` C. Bauman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox