Am Thu, 25 Aug 2016 11:45:40 +0000
schrieb Cauterite <cauter...@gmail.com>:

> - if a function is pure and called with constexpr parameters, the 
> compiler could potentially execute that call in the CTFE engine 
> (automatically), as part of the constant-folding phase I guess. 
> Such a technique will hopefully one day be practical, once the 
> CTFE engine's performance improves.

Just a note on where compiler technology stands right now:
Const-folding after inlining will have this effect for small
pure functions. I've also seen GCC duplicate functions to
remove one of the arguments with a constant if it figured it
could optimize the function around that argument. This is
effectively the same as having a 2nd version of the function
that takes the run-time argument as a compile-time argument.

-- 
Marco

Reply via email to