int to char at compile time

Hendrik Renken funsheep at gmx.net
Tue Mar 20 14:35:20 PDT 2007


hello,

i am trying something like that:

char[] foo(int level, char[] msg)
{
     static c = toString(level);
     return "writefln(\"%d: %s\""~ c ~", \"" ~ msg ~ "\");";
}


int main(char[][] args)
{
    mixin(foo(100, "Test"));
    return 1;
}

but gdmd complaints that toString() cannot be evaluated at compile time. 
is there a way to convert the int to char at compile time?

regards,
Hendrik


More information about the Digitalmars-d-learn mailing list