This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: "format not a string literal"
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: "format not a string literal"
- From: Eli Zaretskii <eliz at gnu dot org>
- Date: Thu, 14 Oct 1999 11:11:05 -0400
- CC: drepper at cygnus dot com, egcs-patches at egcs dot cygnus dot com, gcc-bugs at sourceware dot cygnus dot com
- References: <199910141447.KAA23333@caip.rutgers.edu>
> > 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.