Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: What compilers are y'all using.

Author: Dann Corbit

Date: 20:11:18 07/05/00

Go up one level in this thread


On July 05, 2000 at 22:57:48, Larry Griffiths wrote:

>Hi,
>
>I assume most everyone is using a mixture of C, C++ and assembler for their
>chess programs.  I am having one heck of a time with getting variables aligned
>in the Borland C++ Builder compiler.  I tell it to align on quadwords, but the
>.asm output shows doubleword alignment in segments and align statements before
>variables.
>
>My question is:
>
>What compilers are y'all using for Windows chess programs?

Borland's compiler used to be a honey, but now it's lame (at least the free copy
I of 5.5 I downloaded was -- bleah).  Cygnus GCC (or PGCC) is free and creates
decent binaries.

Personally, I like MS VC++ Enterprise Edition but it is very expensive.  With MS
VC++ (and also with Borland) just do your inline assembly like this corny
example:

/* Increment a and return.  I know, a++, but this is just an *example* OK!? */
inc(int a)
{
__asm { /* or maybe _asm or maybe asm or whatever keyword used by compiler... */
mov EAX, a ; put a in the EAX register
inc EAX ; no need to return anything because EAX is used by conventiion
} /* end asm block */

The alignment will be properly handled and you can use the natural variable
names, even creating and initializeing the tables in C etc.

Of course, portability is right in the toilet when you go to assembly.  I
recommend strongly having an alternative in standard C so that you can recompile
on a 3090 or Connection Machine or Cray or whatever and suddenly have program
x100 speed for nothing but a recompile.

IOW:

#ifdef USE_I86_ASSEMBLY
/* INTEL assembly goes here */
#else
/* standard C goes here */
#endif

You should also benchmark carefully both versions.  You may find (as I did with
a custom coded assembly version of memset) that your version is no faster than
the original.



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.