Argument S to typeof is not an expression

Dicebot m.strashun at gmail.com
Thu May 9 05:57:39 PDT 2013


On Thursday, 9 May 2013 at 12:35:29 UTC, Meta wrote:
>> then add "if (!__ctfe) assert(0);" to guarantee it will never 
>> be used in real run-time.
>
> I don't think I've ever seen __ctfe before. Is it specific to 
> DMD?

It is documented here : http://dlang.org/function.html

"The __ctfe boolean pseudo-variable, which evaluates to true at 
compile time, but false at run time, can be used to provide an 
alternative execution path to avoid operations which are 
forbidden at compile time. Every usage of __ctfe is evaluated 
before code generation and therefore has no run-time cost, even 
if no optimizer is used"

So no, it is quite official and not specific to dmd.


More information about the Digitalmars-d-learn mailing list