Compile time function execution...

Russell Lewis webmaster at villagersonline.com
Thu Feb 15 16:43:29 PST 2007


Ary Manzana wrote:
> A question: is there anyway the compiler can tell the user if a certain 
> function can be executed at compile time? Those six rules may be hard to 
> memorize and while coding sensitive code it would be great to ask the 
> compiler "Is the function I'm writing can be executed at compile time?". 
> Otherwise it's just a guess.

Walter pointed out, faster than I, that an eval!() template does this.

But here's my question: How do we have a compile-time switch which 
controls what to compile-time evaluate and what not?  Somebody 
mentioned, elsewhere, that you would not want to do compile-time 
evaluation in a debug build but you would in a release build.  How would 
one achieve that, other than wrapping every use with a version switch?



More information about the Digitalmars-d mailing list