Purity of alloca()
BCS
none at anon.com
Fri Jul 2 06:50:23 PDT 2010
Hello bearophile,
> Is alloca() pure?
>
> Given the same input alloca() generally returns different pointers, so
> it's not a pure function.
>
> But the same is true for the ptr field when you allocate an array on
> the heap.
>
> And the memory allocated by alloca() never escapes the function, so it
> looks more pure than normal heap allocation :-)
>
As long as you don't pop the stack and do funky stuff with pointers. Vote++
--
... <IXOYE><
More information about the Digitalmars-d-learn
mailing list