trusted purity?

monarch_dodra monarchdodra at gmail.com
Mon Apr 29 10:19:19 PDT 2013


I'm getting strange behavior trying to cast to pure. This is my
test program:

//--------
import std.stdio;
import core.stdc.stdlib;

void main()
{
      auto p1 = &core.stdc.stdlib.free;
      auto p2 = cast(void function(void*))&core.stdc.stdlib.free;
      auto p3 = cast(void function(void*)
pure)&core.stdc.stdlib.free;
      auto pp1 = core.stdc.stdlib.malloc(5);
      auto pp2 = core.stdc.stdlib.malloc(5);
      auto pp3 = core.stdc.stdlib.malloc(5);
      writeln(p1);
      p1(pp1);
      writeln(p2);
      p2(pp2); //This hangs
      writeln(p3); //Never reaches here
      p3(pp3);
}
//--------

Am I doing something wrong? Could somebody else test this? I'm on
win32.

I've also been getting some object violations trying to use this
cast...


More information about the Digitalmars-d mailing list