|
|
|
|
|
by nhebb
5282 days ago
|
|
There are several things I've never had a good understanding of regarding the stack. How big is the stack? Is it a fixed size dictated by the architecture of the processor? I know I've written recursions that overflow it. Other than gut feel and catching an exception after the fact, how do programmers know when their program might overflow it? |
|
It's more to do with the OS or language runtime; I think the language runtime has a bigger impact for most programs.
> Other than gut feel and catching an exception after the fact, how do programmers know when their program might overflow it?
In general, you don't. You might be able to do some system-specific thing on specific systems or just happen to know what it is on some given system, but there's no way to find out in the general case. Worse, there's generally no way to recover from blowing the stack; this has always made programs written using alloca() or, more recently, variable-length arrays potentially unstable.