Compile time function execution...

Michiel nomail at please.com
Thu Feb 15 14:10:15 PST 2007


Walter Bright wrote:

>> Very good point. This could be solved by using some sort of conditional
>> compilation construct on the bits you want to happen at runtime.
> 
> It's the other way around. Functions are always executed at runtime,
> unless they are in a context where a compile-time constant is
> *required*, such as for global variable initialization or template value
> arguments.

I know that's how it's implemented now. But generally, it's a good thing
if as much as possible happens at compile time.

Unless you compile in debug mode, in which you want the compilation fast.

And like Bill said, you also don't want to decompress everything at
compile time and blow up the executable. But that's not a problem if all
you're doing is shrinking subtrees. Like in the case of that second sqrt
call.

-- 
Michiel



More information about the Digitalmars-d mailing list