How do I check if a function got CTFE?

AsmMan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 2 11:42:55 PDT 2014


On Thursday, 2 October 2014 at 18:17:12 UTC, anonymous wrote:
> On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote:
>> I'd like to check if a function got CTFE, ie, the compiler was 
>> able to replace my foo(s); by the computed value at 
>> compile-time.
>>
>> I'm trying to convert the binary executable to assembly by 
>> using objconv tool but I'm finding it very diffucult to find 
>> anything in there, since some converters I've used which does 
>> ELF to ASM keep the function name, e.g, foo() function is a 
>> foo label somewhere in the file but this convert doesn't and 
>> use some numbers

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.


More information about the Digitalmars-d-learn mailing list