Re: inline functions vs. alloca()



phil-news-nospam@xxxxxxxx writes:

If a C compiler such as GCC compiles a function as inline to the code
that was calling it, and that function calls alloca() to allocate some
space for its brief internal use, does that allocated memory still take
up stack space beyond where the inlined code is? If that happens and
the inlined code is allocating large space and/or is "called" inside a
loop, it would seem the stack could quickly become exhausted. I would
hope the compiler will at least restore the stack pointer so at the end
it is the same as at the beginning.

You'll probably get the most accurate answer by trying it out. If the
compiler supports it, you're probably better off with variable sized
arrays.

--
Måns Rullgård
mru@xxxxxxxxxxxxx
.