Roland Mainz <[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:
> - Allocations do not require a function call, just a few instructions
> (e.g. store pointer, adjust stack pointer etc.)
> - The code size and complexity shrinks significantly (e.g. no |free()|
> required in most situations)

Unless you make sure that the size is really only a few bytes, you should
avoid dynamic arrays or alloca() as it could otherwise blow away your program.

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

Reply via email to