Alan Coopersmith <[EMAIL PROTECTED]> wrote:
> >> int foo = some_size;
> >> some_type bar[foo];
> >
> > Yes, I know... but remember the prototype code I send you...
> > The idea is to use the stack for such temporary allocations since it has
> > significant advantages over memory from the heap, including:
>
> Isn't that what alloca() is for? (Ignoring the simple fact that alloca()
> is actually horribly broken since it never tells you if it's failed, just
> lets you corrupt your stack when you ask for too much memory.)
Neither variable sized arrays nor alloca() really corrupt the stack. If you
request too much memory, they do not immediately cause your code to fail.
The programs dumps core if you either use the space or if you try to call
another function from a function that did retrieve too much memory this way.
Jörg
--
EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
[EMAIL PROTECTED] (uni)
[EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code