On Mon, May 07, 2007 at 12:31:00PM -0400, David A. Wheeler wrote:
> There are minor downsides. It's not QUITE as efficient as a
> traditional alloca(), because you're fiddling with malloc() instead
> of changing the stack pointer. If threading were introduced, these
> alloca lists would need to be stored per-thread and malloc would
> have to be thread-safe, which is doable though annoying.
POSIX requires malloc() to be thread-safe, so in the presence of
threads you'd be okay with this design once you had the per-thread
lists worked out.
There is however a more subtle issue: POSIX does not require malloc()
to be async-signal-safe. So if alloca() invokes malloc(), that makes
calling alloca() within a signal handler potentially undefined. Since
alloca() is not a very well standardized function to begin with, I
don't know if there is any code that expects that to work.
-Dave Dodge
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel