gotos

William E. Davidsen Jr davidsen at steinmetz.ge.com
Sat Apr 9 00:08:26 AEST 1988


In article <2556 at ttrdc.UUCP> levy at ttrdc.UUCP (Daniel R. Levy) writes:
> [...]
>I know this battle is an old chestnut, but for the record do you guys believe
>that superfluous flags and great big if-then statements are truly superior
>to the goto?  (And the break, which is a goto by another name.)  E.g.:

But... the break (and continue) are not the same as a goto. The goto
transfers control to a label, which may be anywhere in the program. The
break transfers control out of a loop.
	a) you know what it does when you write it
	b) you know what it does when you read it
	c) you won't move the stupid label or put code before it
	   which should be after.

I maintain that the evil is not the goto but the label. It can be put in
the wrong place to start, and often during program changes gets moved,
or statements inserted on the wrong side of it. I don't contend that
it's EVIL, just that it is inherently a higher overhead to write and
maintain then break and continue.

Yes, I have used a few gotos, but always examine the logic before I do
it. No, I don't think that longjmp() is a solution.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list