Should writef try to statically check for format specifiers?

Jesse Phillips jessekphillips+D at gmail.com
Mon Apr 11 16:44:13 PDT 2011


bearophile Wrote:

> So a solution is to build a fwrite/fwriteln that uses a compile-time string for formatting, that performs compile-time tests using the more efficient CTFE of DMD 2.053:
> 
> int foo, bar;
> fwriteln!"%d %s"(foo, bar); // compile-time error: bar isn't a string!

Two complaints:

fprintf? A leading f is for file.
%s means format as a string not the type is a string.

> Bye,
> bearophile



More information about the Digitalmars-d-learn mailing list