On 11/02/2011 09:00 PM, Adam D. Ruppe wrote:
bearophile:
But how many times do you want to ignore some of the
arguments listed?
I do a lot. The way I do it is the arguments are made
available to the format, but it doesn't always need them
at runtime.
string f = showNames ? "%1$s\t%2$d" : "%2$d";
writefln(f, name, number);
Though I don't literally use writefln for most
my code the same idea applies.
If you use a literal format string, don't use indexed formatting and
don't use all the args, I think it would be safe to call that a bug in
most any case. Fail any one of those pre-conditions and you may have a
point.