Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: piece list possibilities

Author: Dave Gomboc

Date: 16:30:22 07/10/98

Go up one level in this thread


On July 09, 1998 at 16:25:08, Bruce Moreland wrote:

>
>On July 09, 1998 at 12:38:17, Robert Hyatt wrote:
>
>>On July 09, 1998 at 10:31:08, Dave Gomboc wrote:
>>
>>>On July 08, 1998 at 20:33:41, Bruce Moreland wrote:
>>>
>>>>
>>>>On July 08, 1998 at 17:27:41, Tom Kerrigan wrote:
>>>>
>>>>>My problem was that I invariably forgot about the dead-bit scheme and did all
>>>>>sorts of calculations assuming that captured pieces existed.
>>>>
>>>>The only place they exist is in the piece list, and unless you are somehow
>>>>randomly accessing your piece list, the only way you'll access this is via a
>>>>loop, so write the loop once and copy-paste :-)
>
>>>Why copy-paste?  What's wrong with a routine and an "inline this" compile
>>>directive?
>
>It'd be hard to inline just the "for" and an "if".  Sure, you could write an
>iterator function that took another function as a parameter, inline everything,
>and hope for the best, but I bet you wouldn't get the best every time.
>
>>two things.  (1) the "inline" attribute in a program only applies to
>>C++;  (2) you can only "suggest" that a C compiler inline a function.  Just
>>like you can "suggest" that a variable be kept in a register by using
>>"register int sq;".  But you can't force it to happen, and you might eat
>>a lot of function call overhead as a result...
>
>It is a suggestion in C++ as well.
>
>bruce

My comments were not language-specific, but since we are talking "C" here, I am
still not compelled to adapt the copy/paste method.  I think that a macro that
is expanded by the preprocessor would still be better than the alternatives
provided.

Dave Gomboc



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.