scope of malloc
Dave Jones
djones at megatest.UUCP
Thu Nov 22 12:50:28 AEST 1990
>From article <11631 at alice.att.com>, by ark at alice.att.com (Andrew Koenig):
...
> For example, barring alloca() means that the compiler can always know
> the size of the stack frame. That, in turn, means that it is possible
> to maintain the stack using only a single pointer. That implies that
> a function call need update only one stack register and not two.
The Sun C compiler does alloca() properly, so far as I know, so it does
not "know" the size of the stack frame at compile-time. Yet,
not only does it maintain the stack using a single pointer, and
the function call only updates one stack register, but if you don't call
alloca(), the stack pointer is doesn't change until the procedure returns!
It's all kind of clever the way it works. See the SPARC Architecture
Manual, pg. 160.
More information about the Comp.lang.c
mailing list