Compile time function execution...

torhu fake at address.dude
Thu Feb 15 14:29:07 PST 2007


Walter Bright wrote:
> This should obsolete using templates to compute values at compile time.

Wonderful feature, but look at this:

int square(int x)
{
    return x * x;
}

const int foo = square(5);

al_id4.d(6): Error: cannot evaluate (square)(5) at compile time


I was hoping this would make some C macros easier to replace, without 
needing template versions for initializing consts.



More information about the Digitalmars-d mailing list