long long constants
Geoff Keating
geoffk@cygnus.com
Fri Jul 7 15:53:00 GMT 2000
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>
More information about the Gcc-bugs
mailing list