Am I doing it wrong?
Denis Koroskin
2korden at gmail.com
Sun Oct 3 04:04:05 PDT 2010
On Sun, 03 Oct 2010 14:54:06 +0400, Emil Madsen <sovende at gmail.com> wrote:
> So I wrote a program, to find prime numbers, just to check out this pure
> thing;
>
> http://gist.github.com/608493
>
> However, the program has a runtime of about 5 seconds? - in my mind, if
> the
> function is pure, shouldn't the compiler insure that it was evaluated at
> compiletime? - or am I doing it wrong?
>
Make your result an "enum" (i.e. compile-time constant) if you really want
to calculate it in compile-time:
enum primes = calcPrimes();
More information about the Digitalmars-d
mailing list