Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Compiler bug?

Author: Tim Foden

Date: 07:27:56 07/04/02

Go up one level in this thread


On July 04, 2002 at 04:06:26, Sune Fischer wrote:

>On July 03, 2002 at 21:39:39, Dieter Buerssner wrote:
>
>>On July 03, 2002 at 17:57:37, Sune Fischer wrote:
>>
>>
>>>Then it has to be because of the leading zeros, because usually it _is_ a 64 bit
>>>number. The same trick on the file worked great, but that number is
>>>0x0101010101010101, which is then correctly read as a 64 bit type.
>>
>>Of course, it is because of the leading zeros. Anyway, to have an unsigned long
>>long constant, use 0xffULL in Standard ISO C-99. Unfortunately, this is not yet
>>supported by all major compilers. Also, the other Standard C way - (unsigned
>>long long)0xff is not supported by all compilers. However this later method may
>>be easier to support practicably portbable by some typedef.
>
>Yes, it also "looks" better, but its not supported by msvc++ 6 :(

In VC++ you can write: (0xFFi64 << (r << 3))
                   or  (__int64(0xFF) << (r << 3))

More portably you could do something like this somewhere:
  typedef __int64   INT64;  // for VC++
or
  typedef long long INT64;  // for GCC (?)

... and then write: (INT64(0xFF) << (r << 3))
                or  (((INT64)0xFF) << (r << 3))

Cheers, Tim.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.