Subject: Re: 'goto" gone from computer languages or is it!
From: "Dwight K. Elvey" <dwight.elvey at amd.com>
Date: Thu, 12 May 2005 10:37:19 -0700 (PDT)
To: cctalk at
classiccmp.org
Hi
I'd suspect that most didn't like the goto
because it becomes hard to implement in a structured
language. Things like random nesting of subroutines and
then goto's to various points can make things really
messed up. There are also the problems of allocated
memory. Do you keep it or clean it?
Often reading it is the challenge. Goto within a subroutine
usually reads fine. Its when there are subs within Loop/whiles
get mixed with gotos. It's more about readability. Old basic
was bad as often people were also cramped for space (especially
interpreted basics.).
Many think of goto as being similar to jmp in
assembly.
It is.
Actually in a high level language, it is more
complicated
than that. The language tend to lead one to think they
can use it just anywhere. In assembly, you are more
conscious ( or should be ) of thing like stack depth
and allocated space, since you explicitly handle these
things.
You seem to confuse JMP/Jump/goto with Call/JMS/GOSUB as only
the latter affects the stack (in asm).
In assembly you often have jumps as a result of branch conditions
In some cpus the logic is actully skip next instuction on condition.
in basic the conditional is IF xx then Goto YYYY (some allow operations.).
The computed goto is only a replacement for SWITCH or IF THEN trees
and a improvement over the latter.
In the end GOTO is not bad, it is random stringy pasta code that can
result from misuse.
Allison