Check for ctfe

Timon Gehr timon.gehr at gmx.ch
Fri Aug 24 17:22:22 PDT 2012


On 08/25/2012 02:15 AM, bearophile wrote:
> 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

Which is basically guaranteed to be performed.




More information about the Digitalmars-d-learn mailing list