This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: integer
- To: nestor at computec dot com
- Subject: Re: integer
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 23 Mar 2000 09:59:21 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38D9E4BC.8BC99936@computec.com>
> while playing around with type "int" I came across the following
> statement:
>
> int i=-2147483648;
>
> When compiling I got the following message:
>
> "warning: decimal integer constant is so large that it is unsigned"
>
> I think this is a bug since the range of the values of type "int"
> on a 32bit platform is [ -2^31, 2^31) which is -2147483648 to
> 2147483647.
Thanks for your bug report. This is not a bug. In C, -2147483648 is
not a constant, but an expression. 2147483648 is a constant; it is
denoted as signed, but does not fit into signed int, hence the
warning.
If you intended to use a constant for the smallest integer, please use
INT_MIN from <limits.h>; that will compile correctly.
Regards,
Martin