--- Comment #9 from roberto dot gordo at gmail dot com 2007-03-17 17:58
---
I would like to apologize for my faults in gcc bug report 31166, specially to
the people who responded, and fully acknowledge my error. I've misunderstood
your responses. Now, while reading them again, they
--- Comment #5 from roberto dot gordo at gmail dot com 2007-03-14 08:52
---
unsigned is never promoted, it always stays unsigned.
Sorry to insist, but I'm still not convinced. Please, see these examples,
compiled with -std=c99.
{
unsigned u;
int i;
u = 1; /* this is an
--- Comment #6 from roberto dot gordo at gmail dot com 2007-03-14 09:27
---
I think I've found something. According to the ISO C standard, a decimal
constant without suffixes should ALWAYS be signed int (or signed long long if
it does not fit), but never be unsigned! An octal or
--- Comment #7 from roberto dot gordo at gmail dot com 2007-03-14 09:40
---
That's OK, it is not a bug, sorry.
--
roberto dot gordo at gmail dot com changed:
What|Removed |Added
--- Comment #8 from roberto dot gordo at gmail dot com 2007-03-14 12:29
---
I'm still unable to match the behavior of gcc with the ISO C standard. I will
try to explain myself.
The reason for which gcc produces different results with hex constants is now
clear. Also, in the following
--- Comment #1 from schwab at suse dot de 2007-03-13 20:22 ---
0x8000 is of type unsigned int, negating it gives an unsigned int of the
same value, converted to long long still gives the same positive value. On the
other hand 2147483648 is of type long long (in C99) because it does
--- Comment #2 from roberto dot gordo at gmail dot com 2007-03-13 22:27
---
I do not agree at all. Please, read.
So 0x8000 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
--- Comment #3 from schwab at suse dot de 2007-03-13 22:35 ---
(In reply to comment #2)
So 0x8000 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 =
--- Comment #4 from pinskia at gcc dot gnu dot org 2007-03-13 22:35 ---
unsigned is never promoted, it always stays unsigned.
So -0x8000 == 0x8000 :).
Try adding ULL (or UL) if you want an unsigned long long (unsigned long)
constant.
--