Is it possible to force CTFE?

Tommi tommitissari at hotmail.com
Fri Sep 28 11:07:37 PDT 2012


On Friday, 28 September 2012 at 17:52:55 UTC, Tommi wrote:
> In a perfect world, I think, the compiler would always evaluate 
> all possible functions at compile-time, given that doing so 
> would produce a smaller (or equal size) executable than what 
> not-evaluating-at-compile-time would produce.


Or, a simpler rule (for both the compiler and the coder):
Have a compiler flag where you set a value (in bytes), and if a 
function returns a type that's size is not larger than the set 
value, the compiler would execute all calls to that function at 
compile-time (if possible).


More information about the Digitalmars-d-learn mailing list