This is the mail archive of the gcc-help@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]

warning: '0' flag used with '%p' printf format


Hi,
Upon upgrading to gcc-4.2.0, I have begun to get warnings about using "0x%08x" when formatting
pointer arguments for printf-type functions. I obviously should change the %x to %p. But when I do
this, I haven't been able to find a way to continue to have my leading zeros.


gcc warns about asking for leading zeros with %p as in %010p, and eliminating warnings is why this subject came
up at all. However, %010p (leading zeros, 10 chars wide), DOES give me the desired output on my RedHat-EL4
workstation.


My questions are 1) is this an appropriate warning? and 2) how could/should I get my desired behavior (0x followed
by exactly 8 digits) and still use %p to specify pointers?


PS - all of my data pointers will need all 8 hex digits and thus won't have/need leading zeros. But code pointers won't,
and I'd like things to line up.


Thanks, John


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