Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: strlen

Author: Odd Gunnar Malin

Date: 15:06:51 01/24/03

Go up one level in this thread


On January 24, 2003 at 17:29:05, Peter Fendrich wrote:

>On January 24, 2003 at 16:21:30, Odd Gunnar Malin wrote:
>
>>On January 24, 2003 at 05:38:27, Steffen Jakob wrote:
>>
>>>On January 24, 2003 at 04:50:59, Odd Gunnar Malin wrote:
>>>
>>>>On January 24, 2003 at 03:22:37, Steffen Jakob wrote:
>>>>
>>>>>On January 24, 2003 at 03:15:55, Joshua Haglund wrote:
>>>>>
>
>- snip -
>>of my habits, There is many 'if (size<0) return;' etc. in my code, mainly
>>because I reuse so much.
>>
>>Odd Gunnar
>
>Is that bad?
>

Not in general, but to program effective you have to think if the test are ever
true.
Ex. from my add to DrawTable where max entries are 1000:

void add(...)
{
  if (size>=1000)
      return;
   ...
}

Well, there couldn't ever be 1000 position in there if we are playing legal
chess.

or when returning under search:

void remove()
{
  if (size)
    size--;
}

But when I run my code under boundchecker I don't find any write outside the
bounds neither :)

Odd Gunnar



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.