Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: sliding attacks in three #define

Author: Dann Corbit

Date: 10:39:49 04/09/04

Go up one level in this thread


On April 09, 2004 at 07:57:59, Gerd Isenberg wrote:

>On April 09, 2004 at 06:13:45, rasjid chan wrote:
>
><snip>
>>
>>Hi,
>>
>>How can we have #define that extends to the nexct line. My consultant
>>newphew just back from Australia with a BSc(Computer Science) also
>>said cannot be done. So just to make the appear on a page, I just
>>have to cut them to the next line.
>
>
>use backslashes:
>
>#define 	brq_path_clear(x, y, path)                              \
>	((x) <= (y)                                                     \
>	? ((x) == (y)  || isqBit(y) - 1 & ~(isqBit(x) - 1 | isqBit(x))  \
>          &     (path)        & all ? 0 : 1)                            \
>		: (isqBit(x) - 1 & ~(isqBit(y) - 1 | isqBit(y))         \
>                   & (path) & all ? 0 : 1))
>
>
>or use typesafe inline functions ;-)

The "or" here is to be greatly preferred.

For instance:
   brq_path_clear(x++, y++, path);
will expand to:
    ((x++) <= (y++) ? ((x++) == (y++) || isqBit(y++) - 1 & ~(isqBit(x++) - 1 |
isqBit(x++)) & (path) & all ? 0 : 1) : (isqBit(x++) - 1 & ~(isqBit(y++) - 1 |
isqBit(y++)) & (path) & all ? 0 : 1));

Which is not only ugly, but wrong.

[snip]



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.