alloca is bad?

Christopher G. Faylor cgf@cygnus.com
Thu Nov 9 22:20:00 GMT 2000


On Fri, Nov 10, 2000 at 05:11:55PM +1100, Andrew Cagney wrote:
>Nick Duffek wrote:
>> 
>> On 9-Nov-2000, Christopher Faylor wrote:
>> 
>> >I've been told in private email that I mustn't use alloca
>> 
>> Say it ain't so!
>> 
>> >Alloca is useful.
>> 
>> Especially because multi-arching is turning small compile-time constants
>> into run-time variables all over the place.  If we can't use alloca, then
>> wherever there's something like this:
>> 
>>   char rawbuf[MAX_REGISTER_SIZE];
>
>This is being converted to
>
>	char *rawbuf = alloca (MAX_REGISTER_SIZE);
>
>with the knowledge that it probably isn't going to work on some hosts. 
>The conversion is tolerated because a more significant change incures
>greater risk (bigger chance of someone botching it :-).
>
>At the time it was agreed that such alloca() calls should eventually be
>eliminated.

Why?

cgf


More information about the Gdb mailing list