Memory allocation purity

via Digitalmars-d digitalmars-d at puremagic.com
Thu May 15 04:58:30 PDT 2014


On Thursday, 15 May 2014 at 11:35:46 UTC, bearophile wrote:
> Marc Schütz:
>
>> And the optimizations can still be done, because strongly pure 
>> functions can be recognized by their signatures.
>
> What optimizations do you think GDC compiler is doing (or will 
> do) on pure functions?
>

I don't know whether it does or will do any. It is a theoretical 
option ("can be done"). It's the kind of optimizations Ole talked 
about that apply only to functionally pure functions.

But the important point is that `new` can be pure, if you 
consider pure to be about equality, not identity. This applies 
only to typed allocators, not malloc.


More information about the Digitalmars-d mailing list