GC.malloc is pure - wat

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 24 08:05:14 PDT 2015


GC.malloc is marked pure. But it isn't, is it?

This should hold for a pure function:
     assert(f(x) == f(x));
This fails with GC.malloc, of course.

Or consider this:
     auto v = f(x);
     auto w = f(x);
When f is pure, a compiler should be free to reuse the value of v 
for w. That's no good with GC.malloc, obviously.


More information about the Digitalmars-d mailing list