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?


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


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