Compile-time evaluation of real expressions?

Timon Gehr timon.gehr at gmx.ch
Fri Jan 6 19:49:27 PST 2012


On 01/07/2012 12:37 AM, Jonathan M Davis wrote:
> On Saturday, January 07, 2012 00:03:39 Alex Rønne Petersen wrote:
>> Most likely those functions are just implemented using inline assembly,
>> therefore not usable in CTFE.
>
> Yeah, several functions in std.math use inline assembly. So, for them to be
> able to be used at compile time, either the compiler must be expanded to be
> able to run asm statements at compile time (which may or may not be planned
> and may or may not be reasonable), or those functions need another branch
> (using __cfte in an if condition) which doesn't use assembly. Or I suppose
> that if the extra check for __ctfe isn't considered particularly acceptable
> (after all, they're already using assembly)  [snip.]

If the if condition is a constant, there is no runtime overhead.


More information about the Digitalmars-d-learn mailing list