Re: TIB: How does goto work?


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

Re: TIB: How does goto work?




In a message dated 1/31/00 10:36:48 AM Eastern Standard Time, 
johei804@student.liu.se writes:

> 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.

Well, they would have to still be there so that you can see them when you 
edit the code.  Comments still have to be there too!  I'm wondering if the 
goto changes.  That really is pretty stupid if it actually does it like 
that...

                                    Grant Elliott
                                    <A HREF="pa.ticalc.org">Programmers 
Anonymous</A> 


Follow-Ups: