Author: Robert Hyatt
Date: 10:36:05 01/21/03
Go up one level in this thread
On January 21, 2003 at 12:08:08, Uri Blass wrote: >I finished the time of my evaluation of checking bounds. > >It is expensive to buy it and before deciding if to buy it I want to know about >the value of the alternatives. > >How many programmers use it? > > >I talk about it with other programmers(not of chess programs and not in C). > >They suggested the following ideas: >1)Not many people buy checking bounds and this is the reason that the price is >so high. >2)checking bounds may be effective to check some work of other programmers but >programmers who work about their program do not need it. > > >They suggested that it is better if I write functions to do it and replace all >A[i]= with some f(A,i) that will also check for me if i is inside the bounds >that are defined by A. >I said that I think that if I do it then my code will be at least twice slower. Not necessarily. Do this: #if defined(CHECKING) # define F(A,i) CheckBounds(A,i) #else # define F(A,i) A[i] #endif If you -DCHECKING then you will do the checking as above. If you don't, there is no overhead whatsoever. The only problem is that it makes your program harder to read. > >I can also do a special slower code for debug(something that I do not do today) >but I do not like the idea that every time that I add code then I will need to >add also code for debugging. >This may also make me slower in finding specific place that I want to change. > >I know that I may have bugs so practically after every small change I do some >checking to see if I get the expected result by telling the program to print >some information but I delete the code after finding that the program prints the >right information. > >I am interested to read about the experience of programmers that use checking >bounds. It can be very helpful in a program the size of a chess engine. > >I have the following questions for them: > >1)Did checking bounds help you? >2)Do you usually add code for debugging inspite of having checking bounds? >If 1 and 2 are positive then question 3 I have a -DVALIDATE option that causes me to call a function Validate() after every Make/Unmake that I do. Validate() checks _everything_ it can. From the contents of the board to the hash signatures to you-name-it. It slows me way down, but it helps find obvious bugs after a big change. Without the -DVALIDATE there is no overhead at all. > >3)Do you decide to use less debugging code thanks to checking bounds? > >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.