Re: Goto?
- Posted by Jeremy Cowgar <jeremy at c?w?ar.com> May 12, 2008
- 687 views
Matt Lewis wrote: > > Jeremy Cowgar wrote: > > > > Matt Lewis wrote: > > > > > > What's dirty about it? It's no different than exit. Jumping *into* a > > > for loop is bad juju. > > > > > > > How does the loop status get updated? in_loop or loop_stack, etc... ? When > > jumping > > out of a loop via a goto, will it not leave those variables untouched, thus, > > the stack could build and build and build? > > Execution doesn't really care about that stuff. That's all front-end stuff. > Again, take a look at what exit actually does. It's just a goto, with the > target implicitly defined as just outside the current loop. > Hm, but couldn't it invite bugs in the compiler? For instance, look at compile.e around line 146. It checks the length of the loop_stack and makes a decision based on it. Line 3792 dereferences variables (which I assume opens it up for either freeing or re-use of that memory) in the end loop. Now, I do see on line 3873 where return will deref any open loop vars but that will not handle top-level stuff. Just trying to learn the code. -- Jeremy Cowgar http://jeremy.cowgar.com