Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: sliding attacks in three #define

Author: rasjid chan

Date: 11:25:31 04/09/04

Go up one level in this thread


On April 09, 2004 at 13:39:49, Dann Corbit wrote:

>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]

I have a slight awareness of such mistakes but for my own use I use
simple (sq1, sq2). So these codes had to be scrap.
With C (not C++) it is said inline is not assured.

Rasjid







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.