Re: TIB: How does goto work?


[Prev][Next][Index][Thread]

Re: TIB: How does goto work?




On Mon, Jan 31, 2000 at 09:46:28 -0500, KeysDezes@aol.com wrote:
> 
> Some people have been saying that whenever goto is called, it starts at the
> top and goes down until it finds the lbl.  Somehow, this doesn't seem
> possible.  You can write a huge program with a lbl at the very end with all
> the traditional exit stuff (ClrGraph, SetFold(Main), etc), but if it jumps
> there from the very beginning, it does so very quickly.  Much too quickly to
> be checking one line at a time.  The way I always thought (and hoped) that
> it worked was that the compiler replaced all the goto's with
> jumps to addresses.  This way, only the compiler needs to check through the
> code line by line.  That would be much faster and certainly seems more
> logical.  Does anyone know for certain?

It actually *does* check every single line, from the very first one. If you
study tokenized program code carefully (on the computer for example), you
will see that the labels (mainmenu, quit, ... whatever you call them) are still
there.

/Johan


References: