This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: long long constants
- To: mvishnu at bbcr11 dot uwaterloo dot ca (Meenaradchagan Vishnu)
- Subject: Re: long long constants
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: 07 Jul 2000 15:53:04 -0700
- CC: gcc-bugs at gcc dot gnu dot org
- References: <8k5gv3$iov$1.cygnus.bug-gcc@watserv3.uwaterloo.ca>
mvishnu@bbcr11.uwaterloo.ca (Meenaradchagan Vishnu) writes:
> The gnu c++ compiler complains
> "integer constant out of range"
>
> when compiling the following program:
>
> #include <iostream>
> #include <assert.h>
>
> int main()
> {
> assert( sizeof( long long ) == 8 );
> unsigned long long x1 = 0xffffffff00000000;
> cout << x1 << endl;
> }
>
> Is this a bug or a feature?
It's a feature. 0xffffffff00000000 is a constant of type 'unsigned
int', and it's way too big. You probably meant 0xffffffff00000000ULL.
--
- Geoffrey Keating <geoffk@cygnus.com>