Compile time function execution...

Michiel nomail at please.com
Thu Feb 15 13:43:03 PST 2007


Bill Baxter wrote:

>> Maybe the perfect compiler would also pre-execute everything up until
>> the first input is needed. And maybe some bits after.
> 
> You do need some way to turn it off though.
> For an extreme example, most programs from the demoscene make extensive
> use of compressed data that is uncompressed as the first step before
> running.  They would be very unhappy if their language chose to be
> "helpful" by running the decompression routines at compile-time thus
> resulting in a 20M executable.
> 
> Extreme -- but it does demonstrate there are cases where you want to be
> sure some expansion happens at runtime.

Very good point. This could be solved by using some sort of conditional
compilation construct on the bits you want to happen at runtime.

-- 
Michiel



More information about the Digitalmars-d mailing list