------- Additional Comments From pcarlini at suse dot de  2005-09-07 19:09 
-------
(In reply to comment #10)
> The behavior we are mimicing isn't printf()'s behavior.

This statement of yours is by and large incorrect, in the face of the actual
way the C++ Standard is formulated. Please read again 22.2.2.2.2/2!

                                                      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.

This is not the case as far as C99 is concerned. According to the actual
text of the C99 standard passing a signed type to printf("%x") triggers
undefined behavior, see 7.19.6.1/9. And there are good reasons for this,
pointed out moments ago by Martin Sebor on the LWG reflector (6.2.6.2/5
basically allows for negative integers that don't have a valid object
representation in the corresponding unsigned signed type). On the LWG we
are still discussing what the C89 says instead (C89 is rather different).

-- 


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

Reply via email to