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]

Re: Incorrect warning about printf %0<fieldwidth>p format


Jim Avera <jima@cadence.com> writes:

> gcc 3.2 (-Wall) incorrectly complains about the following:
> 
>      void *ptr;
>      printf("The pointer is %010p\n", ptr);
> 
>      ...: warning: `0' flag used with `%p' printf format
> 
> The '0' flag is perfectly legitimate

No, it's not.

§7.19.6.1:

0  For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions,
   leading zeros (following any indication of sign or base) are used to
   pad to the field width rather than performing space padding, except
   when converting an infinity or NaN. If the 0 and - flags both
   appear, the 0 flag is ignored. For d, i, o, u, x, and X conversions,
   if a precision is specified, the 0 flag is ignored. For other
   conversions, the behavior is undefined.

-- 
	Falk


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