Newsgroups: comp.os.minix
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: gotos
Message-ID: <1989Oct6.203815.12548@utzoo.uucp>
Organization: U of Toronto Zoology
References: <24984@louie.udel.EDU>
Date: Fri, 6 Oct 89 20:38:15 GMT

In article <24984@louie.udel.EDU> tweten@gilmore.nas.nasa.gov (Dave Tweten) writes:
>Several apparent believers in the "no gotos" faith responded to the
>effect that in their experience "goto" had never been necessary to
>express an algorithm; they had each gone for some long period of time
>without ever having written one.  I agree.  It IS never necessary.  Any
>algorithm can be expressed in C, using only linear code, "while" and
>functions.  The rest of the control structures in the language,
>including "goto", serve only to increase efficiency, clarity and
>maintainability.

Except that careful thought yields those benefits without gotos.  The
theoretical adequacy of "while" is silly and irrelevant; we're talking
about practical coding.  The point is not that gotos can be avoided,
but that it is easy to do so and the results are better, not worse.
It's not hard to contrive examples where gotos are useful, it's just
that those examples seldom seem to show up in practice... and when they
do, careful thought generally seems to reveal deeper problems.

C News contains no gotos.   Geoff and I have received a number of compliments
on its clarity and maintainability.  And its efficiency approaches the
theoretical ultimate.
-- 
Nature is blind; Man is merely |     Henry Spencer at U of Toronto Zoology
shortsighted (and improving).  | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
