Joerg Schilling wrote: > Peter Memishian <peter.memishian at Sun.COM> 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) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 7950090 (;O/ \/ \O;)
