On Mon, 26 Apr 2004, D. Richard Hipp wrote:

~ If I make use of alloca() in SQLite version 3, will this
~ cause any extreme hardships?  Who is using a C compiler to
~ build SQLite that does not support alloca()?

I have been avoiding using it for my programs heeding the following
warnings from the man pages:

NOTES ON THE GNU VERSION

Normally, gcc translates calls to alloca by inlined code. This is not done
when either the -ansi or the -fno-builtin option is given.  But beware!
By default the glibc version of <stdlib.h> includes <alloca.h> and that
contains the line
   # define alloca(size)  __builtin_alloca (size) with messy
consequences if one has a private version of this function.

The fact that the code is inlined, means that it is impossible to take
the address of this function, or to change its behaviour by linking with a
different library.

The inlined code often consists of a single instruction adjusting the
stack pointer, and does not check for stack overflow.  Thus, there is no
NULL error return.

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

On many systems alloca cannot be used inside the list of arguments of a
function call, because the stack space reserved by alloca would appear on
the stack in the middle of the space for the function arguments.


-- 
Amit Upadhyay


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to