On Phobos GC hunt

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 18 12:00:31 PDT 2014


On 10/08/2014 10:01 PM, Andrei Alexandrescu wrote:
>
> That's a bummer. Can we get the compiler to remove the "if (__ctfe)"
> code after semantic checking?
>
> Andrei

It seems that __ctfe is treated as constant in the backend.
At least there is no asm code generated for these examples (even without 
-O).

     void main()
     {
         import std.stdio;
         if (__ctfe)
             writeln("foo");
     }

     int main() { return __ctfe ? 1 : 0; }


More information about the Digitalmars-d mailing list