This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 3.3: long long bug?
- From: Ben Davis <bndavis at ntlworld dot com>
- To: "Lev Assinovsky" <LAssinovsky at algorithm dot aelita dot com>,"A.R. Ashok Kumar" <ashokar at sankhya dot com>,"Andreas Schwab" <schwab at suse dot de>
- Cc: "Eric Botcazou" <ebotcazou at libertysurf dot fr>,<gcc-help at gcc dot gnu dot org>
- Date: Mon, 7 Apr 2003 21:24:23 +0100
- Subject: Re: gcc 3.3: long long bug?
- Organization: University of Cambridge
- References: <3F6F4712B759A34ABD453A8B39C10D624802AF@bagman.edm.com>
- Reply-to: entheh at users dot sf dot net
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 :)