This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is this warning valid?
- To: "H.J. Lu" <hjl at lucon dot org>
- Subject: Re: Is this warning valid?
- From: Chip Salzenberg <chip at perlsupport dot com>
- Date: Sat, 21 Nov 1998 18:50:48 -0500
- Cc: egcs at cygnus dot com
- References: <m0zh5Vy-000395C@ocean.lucon.org>
According to H.J. Lu:
> # gcc -c x.c
> x.c:1: warning: decimal constant is so large that it is unsigned
>
> Why does gcc complain this? Does gcc think
> -2147483648 != (-2147483647 -1)
Yes, that's what gcc thinks. Unary '-' is an operator, not an
integral (pun intended) part of the syntax of numbers. So 2147483648
is an unsigned int (since it's too large to be signed); then the '-'
is applied to that unsigned int, resulting in another unsigned int.
--
Chip Salzenberg - a.k.a. - <chip@perlsupport.com>
"There -- we made them swerve slightly!" //MST3K