Well the result is assigned to an immutable int, shouldn&#39;t that be a compile const too?<br><br><div class="gmail_quote">2010/10/3 Denis Koroskin <span dir="ltr">&lt;<a href="mailto:2korden@gmail.com">2korden@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Sun, 03 Oct 2010 14:54:06 +0400, Emil Madsen &lt;<a href="mailto:sovende@gmail.com" target="_blank">sovende@gmail.com</a>&gt; wrote:<br>

<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So I wrote a program, to find prime numbers, just to check out this pure<br>
thing;<br>
<br>
<a href="http://gist.github.com/608493" target="_blank">http://gist.github.com/608493</a><br>
<br>
However, the program has a runtime of about 5 seconds? - in my mind, if the<br>
function is pure, shouldn&#39;t the compiler insure that it was evaluated at<br>
compiletime? - or am I doing it wrong?<br>
<br>
</blockquote>
<br></div>
Make your result an &quot;enum&quot; (i.e. compile-time constant) if you really want to calculate it in compile-time:<br>
<br>
enum primes = calcPrimes();<br>
</blockquote></div><br><br clear="all"><br>-- <br>// Yours sincerely<br>// Emil &#39;Skeen&#39; Madsen<br>