Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: debugging question - in case of C ...

Author: Jens Kahlenberg

Date: 07:05:36 06/29/03

Go up one level in this thread


... my advice is to use the assert-macro to state boolean expression at
aproppriate positions in source (see header-file assert.h for details)

On June 29, 2003 at 08:23:44, Uri Blass wrote:

>I found that my latest version show different analysis when I give it the same
>position again.
>
>It is not supposed to happen because I did not implement positional learning and
>after setboard command it should forget everything.
>
>The most logical reason that I can think about it is if
>an important global varaible is changed.

Perhaps variables are not reinitialized and an appropriate assert-macro might
help you ... e. g.: assert( GLOBAL == 42 );

>
>My question is if there is a simple way to check the global varaibles or global
>arrays that have different values.

Global arrays are a little bit trickier to assert. I have to think a while about
the problem. I fear, that you need some extra looping-code embraced by #ifndef
NDEBUG ... #endif (see below)

>
>I can generate a copy for every global varaible and later compare the global
>varaibles with their copies that are not used but this is not a general solution
>because this means that I need to add more debugging code when I add more
>varaibles.
>
>Uri

You're right ... that would mess up your code and you would have to clean it
later ... errorprone :-( In contrast assertions are turned off by compiler-flag:
-DNDEBUG and can reside in your code _forever_

Best regards,
Jens



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.