Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!husc6!cmcl2!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.ARPA (Doug Gwyn )
Newsgroups: comp.lang.c
Subject: Re: goto's in C: an opinion...
Message-ID: <6159@brl-smoke.ARPA>
Date: Thu, 23-Jul-87 18:48:12 EDT
Article-I.D.: brl-smok.6159
Posted: Thu Jul 23 18:48:12 1987
Date-Received: Sat, 25-Jul-87 09:08:28 EDT
References: <3289@bigburd.PRC.Unisys.COM> <7571@beta.UUCP> <765@haddock.ISC.COM> <264@wrs.UUCP>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) )
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 38

In article <264@wrs.UUCP> dg@wrs.UUCP (David Goodenough) writes:
>I seem to remember that in
>some obscure journal or other, one of those structured programming gurus
>(i.e. Djykstra (sp??) / Wirth) said that the only structured concepts
>needed are loops and ifs, everything else is just icing.

That's not quite what the Bohm-Jacopini theorem says.  It says that
any procedural logic (flowchart) can be derived from combinations of
three basic elements: sequence, if-then-else, and do-while.

But that does not have as much relevance to the discussion as you
might think.  Consider that propositional calculus (Boolean logic)
needs only one operator (your choice of NAND or NOR); nevertheless
it is much more in line with human modes of thinking (at least in
the civilized Western world) to express such logic in terms of
several different operators (AND, OR, NOT, IMPLIES, ...).  This is
not "incorrect", and from a practical point of view it is MORE
correct than insisting on writing all Boolean operations in terms
of NANDs.  Similarly, just because one CAN write a program using
a tiny number of constructs does not at all mean that one SHOULD
do so.  It is more important that the program be patently correct
(i.e., that it exactly implement the design function) and that it
be susceptible to ready understanding and modification without
losing those nice properties.

Discussion about whether or not to use "goto" is just about as
pointless as discussing whether or not to call a variable, "event";
if it makes sense to do so in the context of producing correct,
maintainable code, one will naturally do so without having to stop
to debate the issue.  I don't often use "goto" in my C code, but
there are times when it is simply the most obviously correct way
to implement a procedure.  One COULD avoid using "goto" but why
unnecessarily convolute the code?

Now, I'm sure we've all seen horrendous abuses of "goto".  But ALL
programming constructs can be and have been badly abused.  I recall
one posted use of "switch" that was admirably ingenious and gruesome!
(Sorry, I don't recall the details.)