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]
Other format: [Raw text]

[Bug c/80354] Poor support to silence -Wformat-truncation=1


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80354

Eric Gallager <egall at gwmail dot gwu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egall at gwmail dot gwu.edu

--- Comment #4 from Eric Gallager <egall at gwmail dot gwu.edu> ---
(In reply to Martin Sebor from comment #3)
> The warning does just what it's designed to do: point out the potential
> unhandled truncation.  If the argument values are such that the truncation
> cannot occur then using snprintf is unnecessary and sprintf can be used
> instead.

There's other code checking tools (e.g. splint) that say to never use sprintf
and to always use snprintf instead; the manpage on my computer for sprintf also
says to always use snprintf instead. For this reason some projects do
#pragma GCC poison sprintf
in a header file, so sprintf can't actually be used instead in those cases.

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