libpw.a

John F. Haugh II jfh at rpp386.Dallas.TX.US
Tue Apr 18 09:11:54 AEST 1989


In article <9731 at sneaky.UUCP> gordon at sneaky.UUCP (Gordon Burditt) writes:
>>Programmers shouldn't use alloca().  The standard implementation of allocating
>>a chunk of stack is not applicable to all computer architectures or compilers,
>>and the non-stack-based implementations require too much conspiracy and
>>machination to be efficient and worthwhile.
>
>There is an even better reason not to use alloca().  

Yes, Gordon, you could have said it was broken in less than 105 lines.
It is not safe to be screwing with the stack two different ways if
both mechanisms are not fully aware of the others doings.  I don't know
if you could reasonably inline [ ala' GCC ] alloca() and have it ever
work 100% using the example you provided.

However, the simpler case of 

	foo1 = alloca(heap1);
	foo2 = alloca(heap2);
	foo3 = alloca(heap3);
	barf(foo1, foo2, foo3);

DOES work.
-- 
John F. Haugh II                        +-Quote of the Week:-------------------
VoiceNet: (214) 250-3311   Data: -6272  | "When everyone else compiles
InterNet: jfh at rpp386.Dallas.TX.US       |  I will interpret."
UucpNet : <backbone>!killer!rpp386!jfh  +--  [ Not said by ]  -- Doug Davis  --



More information about the Comp.unix.wizards mailing list