On Saturday, 26 August 2017 at 23:53:36 UTC, Cecil Ward wrote:
On Saturday, 26 August 2017 at 23:49:30 UTC, Cecil Ward wrote:
[...]
I was expecting this optimisation to 'return literal constant
only' because I have seen it before in other cases with GDC.
Obviously generating a call that involves running the algorithm
at runtime is a performance disaster when it certainly could
have all been thrown away in the particular case in point and
been replaced by a return of a precomputed value with zero
runtime cost. So this is actually an issue with specific
compilers, but I was wondering if I have missed anything about
any D general rules that make CTFE evaluation practically
impossible?
I suspect I posted this in the wrong category completely, should
have been under GDC (poss applies to LDC too, will test that)