Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: what classes all the serious C++ chess programs have?

Author: Uri Blass

Date: 02:27:54 08/10/04

Go up one level in this thread


On August 10, 2004 at 05:16:28, Alessandro Scotti wrote:

>On August 09, 2004 at 18:02:18, Uri Blass wrote:
>
>>I decided to get rid of global variables and to use classes and the question is
>>what classes I should use exactly.
>
>After reading this post and your other one below I am a bit confused as to
>what's your reason for eliminating global variables. Is it clarity? Speed?
>Something else? This is a very interesting issue and I would like to understand
>it better.


some reasons:
1)I understand that I need to get rid of them if I want to have an SMP version
in the future.

2)Speed.
I believe that remembering a lot of global varaibles is not the fastest way for
chess programs and it is better to remember a varaible only when you need it
becaause there is limited space in the fast memory.

3)Clarity
It is better to have all the time related information in one place in the
program and when I use it in many different places understanding what is going
on is harder.

4)Bugs
With a lot of global varaibles I may do a mistake and change a global varaible
that I do not mean to change(espacially when there are varaibles with different
names).
Without global varaible if I need to call a special class the risk for a mistake
is smaller.

Uri



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.