Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: type qualifiers

Author: Gerd Isenberg

Date: 01:45:18 09/17/03

Go up one level in this thread


On September 16, 2003 at 10:56:49, Anthony Cozzie wrote:

>I am in the process of restructuring Zappa's datatypes, moving from
>
>Search(varlist) {
>  local_decls;
>  .....
>
>to Search(RecursionBlock *rb) {
>  ....
>
>where a RecursionBlock holds all the information that used to be local.
>
>I think there are 3 advantages to this:
>
>1. Converting to an iterative search would be much easier.
>2. All data is accessible at any time/place in the search.
>3. Much less parameter passing is going on.
>
>However, it also makes the job of the compiler much harder, because it doesn't
>know when it can use registers, so I'm looking into keywords to help it out a
>bit. Currently I have two datastructures:
>
>zgame: counters, position, search parameters, and
>zrb: recursion block, contains alpha, beta, etc.
>
>So search (and essentially all functions in Zappa, eventually) looks like
>Search(zgame *g, zrb *rb);
>
>What I *think* I want to do is this:
>
>Search( zgame * const restrict g, zrb * const restrict rb)
>
>Which hopefully tells the compiler that rb and g point to distinct objects, and
>that the objects they point to will not change during the run of the search.  Is
>this right?

Hi Anthony,

not sure whether the restrict keyword.

A far i can see, you pass const pointers,
but not pointer to const data / structs.

Search( zgame * const g, zrb * const rb)
{
   g++;         // is not allowed here
   g->x = ....; // is allowed
}

I'll guess you wan't this one:

Search( const zgame *g, const zrb* rb)
{
   g++;          // is allowed here
   g->x = ....;  // is not allowed
}

Btw. that's often a "syntactical" way to establish new classes.
First you dislike passing a lot of paramters to (sub-)functions.
Then you collect some parameters and locals to a struct to pass them
to "nested" subroutines in a Pascal-like manner.
Then you may look to some semantics and functions working on that data and
finally design an own class of it.

Regards,
Gerd



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.