------- Comment #3 from schwab at suse dot de 2007-03-13 22:35 ------- (In reply to comment #2) > So 0x80000000 is unsigned because does not fit on an int type. That's OK. If > negating it gives an unsigned int of the same value, then, how do you explain > that the following code prints "n1 = -2147483648"
You print it as a signed integer. > It works because the expression should not be unsigned. The value is converted to signed int by printf. > The unary - operator can (and should) apply again the promotion rules, and > should choose int. Integer promotion is only performed on types smaller than int. > The unary - operator can (and should) apply again the promotion rules, and > should choose int. The operand is unsigned int, so there is no promotion. -- schwab at suse dot de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31166