alloca
Chris Torek
chris at mimsy.UUCP
Sat Jun 11 20:01:41 AEST 1988
Put it this way: If you have a stack or an emulation of a stack (as
required by recursive functions), and if `alloca' is a compiler
builtin, the concept can be implemented. Hence alloca can be *made*
portable to any C compiler, if only by fiat (declare that henceforth
`alloca' is a keyword or is otherwise reserved).
Now the problem becomes one of convincing compiler writers that
alloca (possibly by some other name) is worth adding as a reserved
word, or (on some systems) simply writing it in assembly (either as
a routine or with `inline assembly').
Note that alloca is not a panacea, and that it can largely be simulated
with dynamically sized arrays, as in
int n = get_n();
{
char like_alloca[n];
...
}
These are not identical concepts, but they are interrelated. Whether
one is `more important' or `more useful' than another I will not venture
to say.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.wizards
mailing list