[Bug c/14611] static unsigned int small= -1U;

zack at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 17 11:32:00 GMT 2004


------- Additional Comments From zack at codesourcery dot com  2004-03-17 11:32 -------
Subject: Re:  static unsigned int small= -1U;

"ierdnah at go dot ro" <gcc-bugzilla@gcc.gnu.org> writes:

> #define big 6
> unsigned int small=-1;

Think of "unsigned" as meaning "always greater than or equal to zero."

On all platforms supported by GCC, assigning the value -1 to an
unsigned int causes it to be converted to the value UINT_MAX.  This is
the largest number that can fit in an unsigned int.  The C standard
requires this number to be at least 65535, which is (obviously)
greater than 6.

zw


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14611



More information about the Gcc-bugs mailing list