So how do these things work, anyway?

Miscellaneous Forums/General Discussion/So how do these things work, anyway?

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

http://en.wikipedia.org/wiki/Stack_%28data_structure%29
http://en.wikipedia.org/wiki/Call_stack

Basically there aren't enough CPU registers to hold every variable (there were only 3 on the C64!) and so often you have to store the loop index or return address for a function in an area of memory where you can get it back into a register easily later on. The data is stored in a LIFO manner as nomrally you exit the inner loop first, then an outer loop etc. Sometimes you get stack overflow when you get a loop or function calling itself over and over and never exiting properly.