Re: Avoid compile time evaluation

2012-04-13 Thread Andrea Fontana
That's strange, so why writeln make it compile faster? :) I can't post the code, i'll try to reproduce it... On Friday, 13 April 2012 at 13:01:03 UTC, Simen Kjaeraas wrote: On Fri, 13 Apr 2012 14:52:05 +0200, Andrea Fontana wrote: If I have something like: static int var = myFunction(); dm

Re: Avoid compile time evaluation

2012-04-13 Thread Simen Kjaeraas
On Fri, 13 Apr 2012 14:52:05 +0200, Andrea Fontana wrote: If I have something like: static int var = myFunction(); dmd will evaluate myFunction() at compile time. If it can't, it gives me a compile error, doesn't it? If I'm not wrong, static force this. Indeed. If i don't use static,

Avoid compile time evaluation

2012-04-13 Thread Andrea Fontana
If I have something like: static int var = myFunction(); dmd will evaluate myFunction() at compile time. If it can't, it gives me a compile error, doesn't it? If I'm not wrong, static force this. If i don't use static, dmd will try to evaluate myfunction() at compile time, and if it can't,