Roland Mainz <roland.mainz at nrubsig.org> 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:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin
js at cs.tu-berlin.de (uni)
schilling at fokus.fraunhofer.de (work) Blog:
http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily