Joerg Schilling wrote:
> Peter Memishian <[EMAIL PROTECTED]> wrote:
> >  > In general |alloca()| should be avoided in portable code and for
> >  > perforamce reasons since some platforms implement |alloca()| via
> >  > |malloc()|
> >
> > What platform does that?
> 
> This must be a broken platform as nobody will call free() for space
> that has been retrieved via alloca().

The compiler was NOT broken. |alloca()| was implemented via |malloc()|
and some special glue in the prolog/epilog of the consumer function to
deallocate the memory when the function exists (the implementation
didn't care about |longjmp()|... ;-( ), therefore it was standard
conforming (but completly killed the idea that small allocations via
|alloca()| are faster).
That was one of the main reasons why I finally switched over to SAS/C
which implemented this via the "normal" way (e.g. allocating from
stack).

----

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