From: "Allison" <ajp166 at
bellatlantic.net>
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).
Hi
I have no confusion, I meant that jmp instruction does
not effect the stacks, for good or bad. It is that most
high level languages hide the stack actions giving
the false impression that one can goto anywhere. In
assembly, one keeps track of such stuff themselves
so they don't get into such trouble.
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.
else is a jmp. A computed goto is usually done from a table
lookup in assembly although I've seen it done directly for
interupt vectors.
Dwight
In the end GOTO is not bad, it is random stringy pasta code that can
result from misuse.
Allison