Why isn't there more if(__ctfe) in std.math ?

ag0aep6g anonymous at example.com
Sat Sep 23 22:02:23 UTC 2017


On 09/23/2017 11:46 PM, user1234 wrote:
> "if (__ctfe) {}" is a test happening at runtime. Both the if and the 
> else branches got compiled, this implies:
> - more code to cache
> - slower code
> just to allow CTFE.

__ctfe is a constant, though. Any half-decent optimizer will throw away 
the path that's not taken. dmd does it even without the optimization 
flag -O.


More information about the Digitalmars-d-learn mailing list