Compile-time evaluation of real expressions?

Jonathan M Davis jmdavisProg at gmx.com
Fri Jan 6 15:37:20 PST 2012


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), then separate functions meant 
specifically for CTFE would be necessary. I don't know what Don's preferred 
approach would be, but presumably, it would be up to him since he's the 
primary maintainer of both CTFE and std.math.

An enhancement request for it should probably be opened: d.puremagi.com/issues

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list