Re: unsigned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



C tries to generate integers by default, so when you write that number,
which is larger than the signed integer boundary, it will instead
generate an unsigned integer instead and let you know about it. You
should be able to get rid of the warning by writing it as 2147483648U (U
for unsigned).

On 12/04/2006 03:48 PM, Trevis Rothwell wrote:
> Given the following program:
> 
>  int main()
>  {
>    unsigned int squiggy = 2147483648;
>  }
> 
> Compliing on GCC 3.2.3, I get the following warning:
> 
>  $ gcc foo.c
>  foo.c: In function `main':
>  foo.c:3: warning: decimal constant is so large that it is unsigned
> 
> To the best of my knowledge, 2147483648 should fit with ample room to
> spare in an unsigned (4-byte) integer.
> 
> What's going on?
> 


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux