John big10p:
If we are talking of stacks I thought of stacks like functions create them: An enclosed area of memory which holds all the local datas of the function and that is deallocated after the function exits again. This way local and global variables don't interfere with each other for example.
This part of memory that leads to stack overflows with over-recursived programs.
The mainprogram is the core stack
Every function adds a new memory block on this stack and removes it again on exit.
But gosubs don't create a memory block to the stack as they operate on the core stacks data ( which is the reason you can declare globals there, which is the reason you can change "normal" variables of the core program )
If we are talking of stacks I thought of stacks like functions create them: An enclosed area of memory which holds all the local datas of the function and that is deallocated after the function exits again. This way local and global variables don't interfere with each other for example.
This part of memory that leads to stack overflows with over-recursived programs.
The mainprogram is the core stack
Every function adds a new memory block on this stack and removes it again on exit.
But gosubs don't create a memory block to the stack as they operate on the core stacks data ( which is the reason you can declare globals there, which is the reason you can change "normal" variables of the core program )