Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Put your code where your mouth is (was Re: gotos)
Message-ID: <1988Apr20.072000.384@utzoo.uucp>
Organization: U of Toronto Zoology
References: <1988Apr11.201934.20594@utzoo.uucp> <451@goofy.megatest.UUCP>
Date: Wed, 20 Apr 88 07:20:00 GMT

> # Also left as an exercise for the reader is finding the bug in Knuth's
> # hash-table-search code.

For those who don't feel like studying the code, the bug is that the
code infinite-loops if the table is full.  One wonders whether Knuth would
have noticed this if he'd tried to avoid the gotos.

> 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?

To put it bluntly, it's not worth my time.  In most cases the obvious goto-
free code is just as efficient as Knuth's, given a modern compiler.  Much
of what Knuth is discussing can be seen as ways of hand-coding the sort
of optimizations that modern compilers do without being asked.
-- 
"Noalias must go.  This is           |  Henry Spencer @ U of Toronto Zoology
non-negotiable."  --DMR              | {ihnp4,decvax,uunet!mnetor}!utzoo!henry
