Hi, Paul D. Smith elucidated on 29/11/06 02:27: [...] > Finally, there is no way to detect an out of stack error and exit gracefully > with a warning as you suggest: the behavior of alloca() is undefined if you > run out of stack space (it doesn't just return NULL as malloc() etc. do).
Is it undefined in actuality though? Has anyone checked if NULL does get returned from any implementations? (I'm surprised alloca() implementations didn't end up getting NULL returned in implementations over the years. The GLIBC Manual indicates a fatal signal is generated from its implementation: http://www.gnu.org/software/libc/manual/html_node/Disadvantages-of-Alloca.html My view would be that on modern computers switching to allocate from the heap wouldn't make a big difference if it were changed. Modern heaps have pools for small allocations to stop them fragmenting larger allocations anyway. Someone would need to do a compressive test to know for sure, these things often have knock on effects.. I've seen massive slowdowns when someone switched malloc() to calloc() on MS-Windows! Jon _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make