evilness of alloca!

Chris Torek chris at mimsy.UUCP
Sun Apr 23 05:42:39 AEST 1989


Alloca() is a poor-man's substitute for the language construct

	f()
	{
		int n = expr();
		char mem[n];

		...

If dynamic stack declarations were supported directly by the language,
this sort of thing (now done with alloca) would be portable and
reasonable.  Because it is not, alloca is not portable.  In particular,
implementing alloca requires either compiler hooks or a limited
amount of compile-time optimisation.
-- 
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