Author: Robert Hyatt
Date: 08:59:35 01/26/00
Go up one level in this thread
On January 26, 2000 at 11:29:51, Ulrich Tuerke wrote: >On January 26, 2000 at 11:08:50, Tijs van Dam wrote: > >>On January 26, 2000 at 10:59:13, Ulrich Tuerke wrote: >> >>>On January 26, 2000 at 08:08:01, Tijs van Dam wrote: >>> >>> >>>> tree->next_status[ply].phase=FIRST_PHASE; >>>> if (tree->hash_move[ply]==0 && do_null && depth>=3*INCPLY) do { >>>> .... >>>> } while(0); >>> >>>The "do { ... } while (0)" >>>above looks peculiar to me. Another copy mistake ? >> >>No, Dr. Hyatt uses this construction a lot. You can break anywhere inside the do >>and continue with what's beyond it. Like "return;" in the middle of a function. >>IMHO, i think it's ugly. And my compiler broke on it in Crafty's evaluation >>function. > >I can't find a "break" statement inside the "virtual loop". So, it seems to me >that the "loop" can be omitted. I guess that the optimizer will throw it away >anyway because of the constant 0. > >> >>> >>>Uli If there is no break, then something has been accidentally deleted. I will certainly look. There are only two places where I use the do {xxx} while(0); construct. One is to avoid gotos and make the code more readable. The other is in a macro which allows the macro body to be treated as a single statement (ie if (cond) macro). Without the do {} you run into some syntactical issues that can cause errors that are not obvious.
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.