Why free and realloc seem to include .

Michael via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 3 07:03:56 PDT 2017


So this might be a bit of a stupid question, but looking at the 
DMD source code (dmodule.d in particular) I see the following 
code:

>if (srcfile._ref == 0)
>    .free(srcfile.buffer);
>srcfile.buffer = null;
>srcfile.len = 0;

and I was just wondering why certain functions seem to be called 
using the dot operator on its own, unattached to some object. 
This is probably a naive question but I haven't seen this in my 
limited experience using D and I was just wondering why this is. 
I have only really seen this relating to D's manual memory 
management. But in the same file, I see examples like this:

>FileName.free(n);

so what is the case when you should use .free() and why not just 
free()? Thanks.


More information about the Digitalmars-d-learn mailing list