Author: Dieter Buerssner
Date: 17:09:22 01/01/03
Go up one level in this thread
On January 01, 2003 at 15:47:07, Miguel A. Ballicora wrote:
>On January 01, 2003 at 01:01:24, Robert Hyatt wrote:
>
>>That doesn't hurt a thing. a[-1] is one "thing" before a[0]. If a is an
>>integer, a[-1] is simply 4 bytes in front of a[0]...
>
>It might not hurt, but it is undefined behavior. The computer could easily
>crash. I would not recommend it.
I totally agree.
>int a[10];
>
>mean that it is valid to access the value from a[0] to a[9] and use the
>addresses from a[0] to a[10]. Anything else is dangerous.
Yes. Another idea would be, whenever you store a killer move, store it at index
ply+2. This really won't hurt (you've done much efforts to refute a previous
move already, the +2 is nothing). When accessing the killer moves (which
probably is in an inner loop in every chess engine), instead of accessing
killer[ply-2] and killer{ply], access killer[ply+2] and killer[ply].
In another message I have seen, that the pointer trick (for example):
int killer_array[SOME_SIZE];
int *killer = some_array+2;
would be non-Standard C. I think, it is perfectly valid Standard C to access
killer[-2].
Regards,
Dieter
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.