This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: long long constants


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>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]