This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: size_t printf warnings and preprocessor
On Thu, Jul 12, 2001 at 05:48:52PM +0200, Andreas Jaeger wrote:
> Marc Espie <espie@quatramaran.ens.fr> writes:
>
> > I would love to get size_t warnings for printf out of gcc.
> > I've already noticed that 3.0 is much better at following typeinfo than
> > 2.95 used to.
> >
> > I would like to have a switch such that
> > size_t var;
> > printf(format, var);
> >
> > invariably ends in an error, as there can't be a single format that works
> > with size_t.
>
> "%z" is specified by ISO C 99 for size_t. So what's wrong with printf
> ("%z\n", var) ?
>
> Sorry, I'm lost with your proposal.
Nothing is wrong, I don't have the C99 proposal with me... :)
Okay, what I'm proposing still makes sense in the legacy case, for people
who have written code before %z and who would like it checked.
Also, in pedantic C99 mode, do we warn when size_t is used without %z ?