Computer Chess Club Archives


Search

Terms

Messages

Subject: question about local and global variables

Author: Uri Blass

Date: 04:29:12 09/02/01


My question is when it is a good idea to define global variables
instead of local variables

There are some variables in my move generator that originally
were defined only as local variable in some procedures
(I do not need their value when I am not in the  procedures)

I found a trick to make my program slightly faster by defining them
also as global variable and not using them as local variables in part
of the cases.
My question is if there is a rule to know when to delete them
as local variables
I found that in part of my procedures using them as global
varaibles make my program sligtly faster.
when in another part of the procedures
it makes my program slightly slower.

Is there a way to know when it is faster
without testing for every variable?

I use visual studio 6 and I also chose
optimize for speed in my project.

Uri




This page took 0.01 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.