enum return type

Adam D. Ruppe destructionator at gmail.com
Wed Mar 5 15:48:32 PST 2014


On Wednesday, 5 March 2014 at 23:41:30 UTC, Frustrated wrote:
> It would be cool if it was a compile time value though. That 
> way you could make sure code generating ctfe's were never 
> included in the binary.

Yeah... one way to kinda do that now is to write it all inside a 
if(__ctfe) {} block.

string ctfe() {
   if(__ctfe) {
     implementation
   } else assert(0);
}

Still something in the binary but not the whole thing since 
if(__ctfe) in codegen is changed to if(0) and removed as 
obviously dead code.


More information about the Digitalmars-d-learn mailing list