"format not a string literal"
Eli Zaretskii
eliz@gnu.org
Sun Oct 31 23:03:00 GMT 1999
> > printf (n == 1 ? "%d file" : "%d files", n);
>
> An easy to fix bad behavior is not a reason to change the warning,
> even if lots of people do it. This is especially true if the warning
> points exactly to the place where the problem occurs and the fix is
> immediately clear.
>
> Note I submitted patches to fix the cases in gcc which did the above
> ?: silliness as well as several array format string usages. The
> warning in those cases is entirely legitimate.
Could you please explain why this practice is ``silly'', and why does
it deserve a warning? As someone who uses such code, perhaps out of
utter ignorance, I'd like to know why I will be punished by the new
versions of GCC.
In particular, it would be nice to know whether such code violates
some established standards, and if so, which ones.
Thanks.
More information about the Gcc-bugs
mailing list