Check for ctfe

bearophile bearophileHUGS at lycos.com
Fri Aug 24 17:15:00 PDT 2012


cal:

> I saw something on the forum not too long ago about statically 
> checking to see if the current function is being executed at 
> compile time, but can't seem to find it now. Can it be done? 
> (Like static if (__ctfe__) or something)

It's named __ctfe, but unfortunately it's an (immutable) run-time 
value. When you use it you rely on the dead code elimination 
optimization done by the compiler.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list