[Insight-developers] Using alloca

David Cole dlrdave at aol.com
Tue Mar 12 09:57:50 EDT 2013


If you do use it, only do so sparingly and for allocations of no more than a few hundred bytes.

 

http://stackoverflow.com/questions/1018853/why-is-alloca-not-considered-good-practice

 

 


From: Bradley Lowekamp
Sent: ‎March‎ ‎12‎, ‎2013 ‎8‎:‎54‎ ‎AM
To: <insight-developers at itk.org> Developers
Subject: [Insight-developers] Using alloca


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 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130312/fc3feda1/attachment.htm>


More information about the Insight-developers mailing list