[Insight-developers] Using alloca

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Mar 12 08:54:43 EDT 2013


Hello,

I am thinking about using the "alloca" function in some code I'm working on for ITK, and wonder what other people think of it or others experience...

From the BSD Library Functions Manual:

DESCRIPTION
     The alloca() macro allocates size bytes of space in the stack frame of the caller.  This temporary space is automatically freed on return.

I am planning on using it for some dimension sized array in compiled templateless code, in lieu of C99 dynamic stack based arrays.

Best as I can tell Windows defines it as _alloca, so a little CMake try compile is going to be needed, not a big deal.

Thanks,
Brad


More information about the Insight-developers mailing list