Should writef try to statically check for format specifiers?

Andrej Mitrovic none at none.none
Mon Apr 11 13:35:39 PDT 2011


There is a bug here:

import std.stdio;

void main()
{
    int index;
    writef("The index is", index);  
}

Actually I found this bug in some example code: http://d.puremagic.com/issues/show_bug.cgi?id=5836

writef is missing a format specifier. But it still accepts this code.

Is it possible for writef to statically check whether there's a format specifier, assuming there's multiple arguments and the first argument is a string literal?

I realize runtime checks would be out of the question, but I'm looking for compile-time checks when it's possible to do so.


More information about the Digitalmars-d-learn mailing list