Compile time function execution...

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Thu Feb 15 15:21:37 PST 2007


Michiel kirjoitti:
> BCS wrote:
> 
>> 6) when the whole program is const foldable, e.i. no runtime inputs,
>> like with some scientific software.
> 
> And why would it be a problem if the whole program is reduced to
> printing constants to the output? It would certainly be small and fast.

If the compiler generates a new instance of the algorithm whenever it is
needed (i.e. function is partially evaluated), it can actually produce
longer code than when simply calling the same function over and over.
It's almost like inlining functions whenever possible.



More information about the Digitalmars-d mailing list