Alloca: Its use is hazardous to the health of your program?

Karl Heuer karl at haddock.ima.isc.com
Fri Jun 8 12:18:49 AEST 1990


In article <1990May31.004024.29385 at agate.berkeley.edu> andychoi at ocf.berkeley.edu (Andrew Choi) writes:
>One last question:  Why is alloca so machine-dependent?  It seems that
>it shouldn't be ...

If it's implemented as a front-end to malloc(), then it's hard to make sure
the free() gets done when the function ends.

If it's implemented by expanding the stack frame, then on machines that have
no frame pointer it can't be done without assistance from a compiler builtin.

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list