This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is this warning valid?
- To: egcs at cygnus dot com
- Subject: Re: Is this warning valid?
- From: Marc Lehmann <pcg at goof dot com>
- Date: Sun, 22 Nov 1998 02:18:00 +0100
- References: <m0zh5Vy-000395C@ocean.lucon.org>
On Fri, Nov 20, 1998 at 09:23:22PM -0800, H.J. Lu wrote:
> Hi,
>
> # gcc -c x.c
> x.c:1: warning: decimal constant is so large that it is unsigned
>
> Why does gcc complain this?
-2147483648 is outside the range that ISO-C guarantees for unsuffixed
decimal constants (i.e. decimal constants must be -2147483647 ..
+2147483647)
I think the warning is confusing, but valid (as that value is treated just
like -2147483648U)
> Does gcc think
>
> -2147483648 != (-2147483647 -1)
Yes, and rightly so: the second case involves _two_ decimal constants, not
one.
> int i = -2147483648;
> int j = -2147483647 -1;
-----==- |
----==-- _ |
---==---(_)__ __ ____ __ Marc Lehmann +--
--==---/ / _ \/ // /\ \/ / pcg@goof.com |e|
-=====/_/_//_/\_,_/ /_/\_\ --+
The choice of a GNU generation |
|