How to fake pure

Dom DiSc dominikus at scherkl.de
Tue Apr 8 11:28:57 UTC 2025


Hi.

I want to create my own allocator, but using malloc is not pure 
(it internally has to have some "global state"). But the GC also 
has this "global state" and still is considered "pure".
So internally the impurity of the allocators has been hidden.

How can I do this?
adding @trusted doesn't do the trick, declaring it extern(C) also 
doesn't help.
Do I have to compile the file containing the allocator with some 
special switches turned on or off or something?


More information about the Digitalmars-d-learn mailing list