Jonathan M Davis:
> However, what can be used in CTFE is currently rather limited.

Currently its main limitation is the amount of memory it burns. I think Don 
will eventually remove this problem too, even if this requires a half rewrite 
of the whole thing :-)


> You also generally have to force the issue a 
> bit by using it in places where the value _must_ be known at compile-time 
> (such 
> as enum values, member variable initializations, etc.). I'm not sure that 
> CTFE 
> gets done at this point if it doesn't need to be.

Currently CTFE is performed only where explicitly asked for. DMD doesn't 
currently perform partial compilation (except the kind of manual compilation 
done with constant template arguments).


> So, how much CTFE does for you depends on the current state of the compiler 
> (and 
> likely whether you compiling with optimizations turned on), but it definitely 
> has 
> the capacity to run functions - especially pure ones - at compile time such 
> that 
> they may never get called at runtime.

As far as I know, currently optimization level doesn't influence CTFE.

Bye,
bearophile

Reply via email to