How do I check if a function got CTFE?

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 2 12:04:56 PDT 2014


On Thursday, 2 October 2014 at 18:42:56 UTC, AsmMan wrote:
> I was thiking the dmd compiler did CTFE without someone ask for 
> this, in the way as I've mentioned, checking for constant 
> arguments + function's purity and if all this is true, it did 
> the CTFE rather than generate code to compute it at run-time. 
> In the case of it did happen, I just wanted to know. It was my 
> misunderstsooding how it does works in dmd.

Yeah, that would be constant folding. The compiler is free to do
that. It's just not called "CTFE" then.


More information about the Digitalmars-d-learn mailing list