This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62160] std::uppercase does not work for std::hex output
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 16 Aug 2014 14:47:31 +0000
- Subject: [Bug c++/62160] std::uppercase does not work for std::hex output
- Auto-submitted: auto-generated
- References: <bug-62160-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62160
Daniel KrÃgler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #1 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> ---
The observed behaviour looks correct to me. The effects of std::uppercase are
defined to set the basefeld to hex and this again corresponds to the stdio
equivalent of %X (see Table 85 â Integer conversions). The fprintf format
specification does specify that any of the x or X specifiers is relevant only
for integer types, there is no indication that pointer output according to the
%p (This is also what the C++ refers to) is affected by %x or %X. Keep in mind,
that the specification of void* output format does not require any specific
format. The specification only says:
"The argument shall be a pointer to void. The value of the pointer is
converted to a sequence of printing characters, in an implementation-defined
manner."
So, if you want to have more control over the IO of pointers, you should cast
the to an integer value (correctly done via std::[u]intptr_t), and output the
corresponding integer value.