[Bug c++/78014] -Wformat -vs- size_t
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 17 19:57:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78014
--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I think this is essentially the same as bug 77970 - making such warnings
smarter about the case of standard typedefs.
Of course an expression resulting from sizeof must be considered
appropriate for %zu. Likewise _Alignof. Likewise SIZE_MAX, but headers
or predefines just define it to use an appropriate constant suffix, so
without looking at the macro being expanded there's nothing to distinguish
it from any constant where the user wrong such a suffix directly.
Likewise an expression where the user did "typedef size_t my_size_t;" and
then used my_size_t. And what about expressions resulting from arithmetic
on size_t values? So it may be hard for the compiler to tell exactly what
expressions are appropriate for use with %zu (even without direct use of
__SIZE_TYPE__).
More information about the Gcc-bugs
mailing list