Author: Dann Corbit
Date: 12:07:29 04/09/04
Go up one level in this thread
On April 09, 2004 at 14:25:31, rasjid chan wrote: >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. All the modern C compilers have some way to inline. But the type safety and macro side effect prevention alone are enough reason never to use macros for functions. It is a very bad practice and it will surely cause more grief that any tiny incremental speedup you might possibly realize.
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.