[gst-devel] We should use alloca(3).

Tim Müller t.i.m at zen.co.uk
Fri Apr 2 05:53:33 CEST 2004

On Monday 29 March 2004 19:18, Andy Wingo wrote:


> I think we should promote the use of alloca(3). (Yes, go read that man
> page.)

You mean the 

   "The alloca function is machine and compiler dependent. On many 
    systems its implementation is buggy. Its use is discouraged."

bit?  ;-)

> To hack around the disadvantage, autoconf has AC_FUNC_ALLOCA. (Yes, go
> read `info autoconf' if you're still with me.) It requires a bit of
> build infrastructure support, possibly conditionally compiling an
> alloca.o object file. Probably the best way to do this is to have a
> gst-lib for alloca.

There's also a g_alloca() in GLib:


I'm not sure what GLib does on systems where there is no native alloca and the 
compiler doesn't support it either, but given that g_alloca() is used in both 
qsort.c and gconvert.c I'd think it's safe to assume that GLib somehow makes 
sure that g_alloca() works on every system where GLib runs.


More information about the gstreamer-devel mailing list