Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Porting Crafty

Author: Peter W. Gillgasch

Date: 23:16:03 01/15/98

Go up one level in this thread


On January 16, 1998 at 01:10:32, Robert Hyatt wrote:

>On January 15, 1998 at 20:47:57, Peter W. Gillgasch wrote:
>
>>On January 15, 1998 at 18:33:13, Carsten Kossendey wrote:
>>
>>>On January 15, 1998 at 16:41:34, William Bryant wrote:
>>>
>>>>As I understand it, isn't crafty written in ANSI C.
>>
>>It is not. "long long" and "__int64" are *far* from ANSI... Probably no
>>single module of Crafty is ANSI C...
>>
>
>actually, the new ANSI standard does have long long.  It just doesn't
>specify
>how many bits.  Just like "int".. is it 32 or 64?  Depends on the
>machine..

You are right about the sizeof(long long) being machine dependent. But
the C9x draft is certainly not the latest ANSI standard. That is C89.

>
>>>Mostly, but Metrowerks violates all kinds of standards,
>>
>>FAME ON... It implements ANSI C *perfectly*.
>>You don't know what you are talking about.
>
>I know of one thing where it fails.  The way I do globals in Crafty
>is most definitely ansi, but that compiler doesn't like it.  IE I
>include a .h file with global definitions in every .c file, and that
>compiler goes ape-snot and tries to allocate each copy of the globals
>separately.  This is convered explicitly in the ansi standard and is
>referred to as "the unix method of declaring global variables."  This
>caused massive problems the last time someone tried to port to the Mac..

Right. OTOH you should read the C FAQ :) The "unix method" is an
*extension*. Compiler writers (or to be more precise, linker writers)
have the *option* to support this kind of, eh, programming style ;) You
should put your externs into a header and guard it with the old

#ifndef GLOBALS_H
#define GLOBALS_H

#endif GLOBALS_H

idiom. You are certainly asking for trouble if you don't... And on the
Mac, if you ask for trouble you actually get it :)

-- Peter






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.