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 libstdc++/23757] iostreams hex formatting for signed integers treats than as unsigned


------- Additional Comments From x at xman dot org  2005-09-07 18:40 -------
The behavior we are mimicing isn't printf()'s behavior. printf() doesn't print
out hexadecimal signed integers as though they were unsigned integers. Intead,
C's type coercion allows the signed integers to be interpreted as unsigned
integers, and printf() then prints out the unsigned integers. While I understand
the value of printf() compatibility, one of the key differentiators with
iostreams is type safety, which is effectively broken with the current behavior.
If we wanted to preserve printf() like behavior then 'cout << hex << "some
string"' should print out the address of the string literal in hex, rather than
the string literal's contents, ignoring the hex flag completely.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23757


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