Variable arguments with file and line information?

Rob T alanb at ucora.com
Sun Nov 17 13:08:38 PST 2013


Good points, got it down to this.

void error(string a_Msg, string file = __FILE__, size_t line = 
__LINE__)
{
    writefln( a_Msg ~ ". In file %s on line %d.", file, line );
}

int main()
{
    format("hallo").error;
    format("Hallo %s.", "du da").error;
}

There should be no more template bloat, and it looks to be about 
as usable and simple as possible.

Do you see any further optimizations that do not increase the 
usage convenience?

--rt


More information about the Digitalmars-d-learn mailing list