Joerg Schilling wrote:
> 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.

I know... I don't intend to allocate 300GB that way... :-)

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to