Am I doing it wrong?

Emil Madsen sovende at gmail.com
Sun Oct 3 04:08:33 PDT 2010


Well the result is assigned to an immutable int, shouldn't that be a compile
const too?

2010/10/3 Denis Koroskin <2korden at gmail.com>

> 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();
>



-- 
// Yours sincerely
// Emil 'Skeen' Madsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101003/ac708112/attachment.html>


More information about the Digitalmars-d mailing list