This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: alloca is bad?


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.

	Andrew

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]