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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux