This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: "format not a string literal"


>  >   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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]