long long int array warning

Richard Boylan boylan@sw.stratus.com
Tue Jun 13 07:50:00 GMT 2000


You need to use the 'LL' suffix on your constants.

On Tue, 13 Jun 2000, Erick Hallick wrote:

> I am getting a strange warning which I believe is incorrect when declaring 
> an array of long long int's.  Consider the following simple code:
> 
> #include <stdio.h>
> 
> int main()
> {
>   int i;
>   long long int a[] =
>   {
>   1,
>   2,
>   2000000000,
>   4000000000,
>   8000000000,
>   -8000000000
>   };
> 
>   for(i=0;i<=5;i++)
>     printf("a[%d] = %lld\n", i, a[i]);
> 
> 
>   return 0;
> }
> 
> I get the following error while compiling:
> 
> ehallick@netfinity:~ > gcc -Wall test.c
> test.c: In function `main':
> test.c:11: warning: decimal constant is so large that it is unsigned
> 
> I've tried casting the constants to (long long int), but that doesn't get 
> rid of the warning.  Does anyone know if I'm doing anything incorrectly?

Richard Boylan
Stratus Computer
Maynard, Massachusetts USA
boylan@sw.stratus.com




More information about the Gcc-bugs mailing list