Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcnc!rutgers!ames!ptsfa!ihnp4!cuae2!killer!jfh
From: jfh@killer.UUCP (The Beach Bum)
Newsgroups: comp.lang.c
Subject: Re: goto's in C: an opinion...
Message-ID: <1191@killer.UUCP>
Date: Sun, 26-Jul-87 15:38:37 EDT
Article-I.D.: killer.1191
Posted: Sun Jul 26 15:38:37 1987
Date-Received: Tue, 28-Jul-87 02:24:39 EDT
References: <3289@bigburd.PRC.Unisys.COM> <7571@beta.UUCP> <765@haddock.ISC.COM> <264@wrs.UUCP>
Organization: The Unix(tm) Connection, Dallas, Texas
Lines: 65
Summary: Just loops and ifs?

In article <264@wrs.UUCP>, dg@wrs.UUCP (David Goodenough) writes:
> In article <765@haddock.ISC.COM> karl@haddock.ISC.COM (Karl Heuer) writes:
> >In article <7571@beta.UUCP> hwe@beta.UUCP (Skip Egdorf) writes:
> >>In any language that supports a complete set of structured constructs,
> >>there is NO NEED for a goto, and the statement should be removed from
> >>the language!
> >
> >The statement is true with the qualifier.  However, I do not know any language
> >that supports what I would consider a "complete set" of structured constructs.
> >Perhaps ADA does, but I'm not sure I want to use something that big.
> 
> Now it's my turn to play devil's advocate - 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. Now looking at
> every language so far designed, I see some form of loop and some form
> of if. So what are we (myself included) all bitching about??????????

Every high level construct can be faked with just if's and goto's.

But even if's can be faked with top-tested loops.  (while loops in
c and pascal, etc)

Consider:

	if boolean_expression then
		statement;

and

	loop_ending_flag := false;
	while boolean_express and not loop_ending_flag do begin
		statement;
		loop_ending_flag := true
	end

both of these are the same!  Only the second _probably_ runs slower
and definitely looks like crap.

The second example is for wanting a loop and no goto's:

	while_loop:
	if boolean_expression then begin
		statement;
		goto while_loop
	end;

and
	while boolean_expression do
		statement;

Once again, both of these should be the same, except the second is
now much more clear.  Even a case for the case statement can be
made with multi-level if's or some other form of computed goto.
The variety of language contructs in a language such as pascal or
c makes for _more_clearly_ expressing the intent of the programmer.
I am against any group of people telling me not to use a language
construct.

- john.
-- 
John F. Haugh II		HECI Exploration Co. Inc.
UUCP:	...!ihnp4!killer!jfh	11910 Greenville Ave, Suite 600
"Don't Have an Oil Well?"	Dallas, TX. 75243
" ... Then Buy One!"		(214) 231-0993