On 2009-10-13 09:11:08 +0200, "Lars T. Kyllingstad"
<pub...@kyllingen.nospamnet> said:
I may be wrong, but I seem to remember reading somewhere that DMD
always tries to evaluate as much as possible at compile time. That is,
if a function is CTFE-enabled, and its input is known at compile time,
it is calculated at compile time.
void main(string[] args) {
auto x = foo(args[1]); // foo() is evaluated at run time
auto y = bar("baz"); // foo() is evaluated at compile time
}
you are wrong, compile time evaluation is not performed if not
requested (by making that constant for example).
The compiler cannot know the complexity of the calculation, and making
it at compile time is much slower...
thus you have to explicitly instruct the computer to do it...