Put your code where your mouth is (was Re: gotos)

Daniel R. Levy levy at ttrdc.UUCP
Sun Apr 17 13:39:30 AEST 1988


In article <1988Apr15.170753.867 at utzoo.uucp>, henry at utzoo.uucp (Henry Spencer) writes:
# > The best collection of thoughts I have seen on this issue is by Donald
# > Knuth, entitled "Structured Programming with goto Statements"...
# 
# The amusing thing about Knuth's article is that when you subtract out the
# search loops (which can be handled with break or return), the syntax
# example (which can be done *much* more elegantly using ungetc()), and the
# things that any modern compiler (NB the 4BSD VAX compiler is an antique)
# would look after for you... there's nothing left!
# 
# Also left as an exercise for the reader is finding the bug in Knuth's
# hash-table-search code.  (He might possibly have corrected this in the
# reprint; my copy is the original Computing Surveys paper.)  The hazards
# of gotos doth make fools of the best of us...

"Left as an exercise" (being implied in re the ways that Knuth's limited
endorsement of goto can supposedly be refuted) sounds more like "I just don't
want to bother showing why this is true, and anyone who doesn't agree is
a lazy dolt."

Mr. Spencer, put your code where your mouth is.  For each goto example in
Knuth, show us how you would code it to run equally efficiently without
gotos.  Fair enough?
-- 
|------------Dan Levy------------|  Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
|         an Engihacker @        |  	<most AT&T machines>}!ttrdc!ttrda!levy
|     AT&T Data Systems Group    |  Disclaimer?  Huh?  What disclaimer???
|--------Skokie, Illinois--------|



More information about the Comp.lang.c mailing list