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]

[Bug c++/62160] std::uppercase does not work for std::hex output


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.

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