This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Is this warning valid?


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                        |
                                                          |


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]