GC.malloc is pure - wat

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 24 10:57:11 PDT 2015


On Friday, 24 April 2015 at 17:45:57 UTC, anonymous wrote:
> On Friday, 24 April 2015 at 17:07:20 UTC, deadalnix wrote:
>> On Friday, 24 April 2015 at 15:43:17 UTC, anonymous wrote:
> [...]
>>> Could core.stdc.stdlib.malloc and friends also be marked pure 
>>> then?
>>
>> No.
>>
>> Allocating on the GC is "stateless" as the GC will handle the 
>> state by itself, from the program perspective, there is no 
>> state to maintain.
>>
>> malloc require free, and the state management is pushed on the 
>> application rather than the runtime. It is not pure.
>
> There's also GC.free, which is also marked pure.
>
> I can't see how GC.malloc followed by GC.free is more pure than 
> stdlib malloc followed by stdlib free.

GC.free should probably not be pure, but that is also not at all 
what you talk about in previous posts, which led me to think you 
are essentially doing a stunt as to not admit you were wrong.


More information about the Digitalmars-d mailing list