Danny, At 12:55 2003-02-17, Danny Smith wrote:
I was clearly confused about what "alloca" does: It allocates space on the stack, _not_ on the heap, as I thought.Randall R Schulz <rrschulz at cris dot com> wrote:> A couple of months ago, someone reported on how local (stack) > allocations larger than a certain threshold were allocated on the heap. > In fact, you, Danny, contributed materially to that thread: Subject > "Strange behaviour of gcc" starting with a posting by > [EMAIL PROTECTED] on Dec. 24, 2002. No that's not quite right: Stack allocations larger than one page (4KB) cause gcc to probe the stack. The allocation is still static
However, there must be a terminological issue here, because I would describe what alloca does as _dynamic_ stack-resident allocation. It is dynamic because it happens as a result of a run-time call. I understand static to mean an action (allocation, binding, computation, etc.) that is handled entirely at compile and / or link time.
I think, also, the stack probe is automatically called in main, to force alignment of stack to a page boundary. ... Danny
Randall Schulz
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/