This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: long long int array warning
- To: Erick Hallick <ehallick at edam dot cpm dot com>
- Subject: Re: long long int array warning
- From: Richard Boylan <boylan at sw dot stratus dot com>
- Date: Tue, 13 Jun 2000 10:50:03 -0400 (EDT)
- cc: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
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