This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: gcc 3.3: long long bug?


What a great thread. Lots of confused replies :) But yeah, it seems to me 
(after doing a test or two of my own with GCC 3.2) that GCC has lost the 
ability to automatically recognise huge integer constants as 'long long'. 
Whether this change was made by accident, or to conform to a new standard, or 
for some deep reasons that have something to do with "it's harder to go 
wrong"-type flame wars, I have no idea ...

On Monday 07 April 2003 2:30 pm, Lev Assinovsky wrote:
> With 3.3 I have to write:
> const long long n =
> #ifdef WIN32
> 34359738368
> #else
> 34359738368LL
> #endif
> ;

I recommend you check for the __GNUC__ symbol instead. There are builds of GCC 
for Windows ( http://www.mingw.org/ ), and there are other compilers that 
won't recognise the LL suffix.

In this case, though, you should probably use the following for clarity:

   const long long n = (long long)1 << 35;

This will be evaluated at compile time. Note that the cast applies only to the 
1, not to the whole expression.

Incidentally, I didn't know MSVC supported 'long long' as a type - I thought 
you had to use __int64. I suppose it's new in the latest version or 
something, since 'long long' is in the C99 standard (I think). It's certainly 
an improvement :)

Ben

PS. Hi Eric :)


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