Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about crafty chess.h

Author: Robert Hyatt

Date: 11:55:56 01/08/03

Go up one level in this thread


On January 08, 2003 at 08:25:06, Uri Blass wrote:

>1)I think to define bitboard for pawn structure so I looked at crafty code to
>see how to define bitboard(My first try typedef unsigned__int64 Bitboard) did
>not work and only after looking at crafty code(chess.h) I found that I forgot a
>space between the unsigned and the __)
>
>2)chess.h in crafty has the following code
>
>#if defined(HAS_64BITS)
>  typedef unsigned long BITBOARD;
>#else
>#  if defined(NT_i386) || defined(NT_AXP)
>    typedef unsigned __int64 BITBOARD;
>#  else
>    typedef unsigned long long BITBOARD;
>#  endif
>#endif
>
>Do I need all this #if's and in which machines my code is not supposed to work
>if I avoid them and simply defined bitboard as unsigned__int64
>Noe the problem is to understand chess.h that is a basic file.

__int64 is _only_ going to work on microsoft's compiler.  It will not work
on gcc or any other compiler I know of.  If you have no need to compile with
other compilers (gcc, etc) then you can do without the spaghetti code above.

>
>3)My opinion that it may be good if there will be some advice to the reader in
>main.c to read chess.h(I did not look at the latest crafty source code but the
>problem for a beginner is where to start to read and there is no advice to start
>reading in chess.h
>
>4)The code that I downloaded crafty18.12(I guess no difference in latest crafty)
>begins with the words
>
>#if !defined(TYPES_INCLUDED)
>
>I think that a comment that tell the reader in what system it is defined may be
>productive.
>
>Uri


No.  That allows you to concatenate several source files into one big file, and
then
compile them with no error.  If you do that normally, the second #include
chess.h
will produce a million errors about macro re-definitions, etc.  If you look at
the
bottom of chess.h, you will see

#define (TYPES_INCLUDED)

which means that the _next_ #include chess.h in this file will not do anything
and
won't produce all those errors.



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.