getting rid of global variables
Posted: 12 Jul 2005, 10:28
I am planning to get rid of my global varaibles and have structure similiar to fruit when variables that are used in some files are included only in part of the files.
The problem is that global variable appears in more than one file and
I am not sure of how to divide the variables to files
I think that the first step will be simply to write note for every variable and every function in which jobs they are used in order to design how exactly to divide the programs to files(I use the word job and not files because I may divide some of my long files to more files and one of the reason that I did not do it until today is speed because I found that including all the global variables in more files is more expensive and having seperate file for the qsearch that include all the global variables made movei slower so alphabeta together with the qsearch and more functions like sorting moves is in the same file today)
I wonder if people have experience in getting rid of global variables.
Uri
The problem is that global variable appears in more than one file and
I am not sure of how to divide the variables to files
I think that the first step will be simply to write note for every variable and every function in which jobs they are used in order to design how exactly to divide the programs to files(I use the word job and not files because I may divide some of my long files to more files and one of the reason that I did not do it until today is speed because I found that including all the global variables in more files is more expensive and having seperate file for the qsearch that include all the global variables made movei slower so alphabeta together with the qsearch and more functions like sorting moves is in the same file today)
I wonder if people have experience in getting rid of global variables.
Uri