U
user923005
I seem to recall that if a macro is evaluated and the macro is
defined, but a value for the macro does not exist, it should be
evaluated as zero, but I can't find it in the standard. There is a
program called Hoichess, that has the following include file:
#define EXPTOSTRING1(x) #x
#define EXPTOSTRING(x) EXPTOSTRING1(x)
#ifdef DEFAULT_HASHSIZE
std::cout << "\tDEFAULT_HASHSIZE " << EXPTOSTRING(DEFAULT_HASHSIZE)
<< "\n";
#endif
#ifdef DEFAULT_PAWNHASHSIZE
std::cout << "\tDEFAULT_PAWNHASHSIZE " <<
EXPTOSTRING(DEFAULT_PAWNHASHSIZE) << "\n";
#endif
#ifdef DEFAULT_EVALCACHESIZE
std::cout << "\tDEFAULT_EVALCACHESIZE " <<
EXPTOSTRING(DEFAULT_EVALCACHESIZE) << "\n";
#endif
#ifdef DEFAULT_BOOK
std::cout << "\tDEFAULT_BOOK " << EXPTOSTRING(DEFAULT_BOOK) << "\n";
#endif
#ifdef USE_UNMAKE_MOVE
std::cout << "\tUSE_UNMAKE_MOVE " << EXPTOSTRING(USE_UNMAKE_MOVE) <<
"\n";
#endif
#ifdef USE_IID
std::cout << "\tUSE_IID " << EXPTOSTRING(USE_IID) << "\n";
#endif
#ifdef USE_PVS
std::cout << "\tUSE_PVS " << EXPTOSTRING(USE_PVS) << "\n";
#endif
#ifdef USE_HISTORY
std::cout << "\tUSE_HISTORY " << EXPTOSTRING(USE_HISTORY) << "\n";
#endif
#ifdef USE_KILLER
std::cout << "\tUSE_KILLER " << EXPTOSTRING(USE_KILLER) << "\n";
#endif
#ifdef USE_NULLMOVE
std::cout << "\tUSE_NULLMOVE " << EXPTOSTRING(USE_NULLMOVE) << "\n";
#endif
#ifdef USE_FUTILITYPRUNING
std::cout << "\tUSE_FUTILITYPRUNING " <<
EXPTOSTRING(USE_FUTILITYPRUNING) << "\n";
#endif
#ifdef USE_EXTENDED_FUTILITYPRUNING
std::cout << "\tUSE_EXTENDED_FUTILITYPRUNING " <<
EXPTOSTRING(USE_EXTENDED_FUTILITYPRUNING) << "\n";
#endif
#ifdef USE_RAZORING
std::cout << "\tUSE_RAZORING " << EXPTOSTRING(USE_RAZORING) << "\n";
#endif
#ifdef USE_EVALCACHE
std::cout << "\tUSE_EVALCACHE " << EXPTOSTRING(USE_EVALCACHE) <<
"\n";
#endif
#ifdef EXTEND_IN_CHECK
std::cout << "\tEXTEND_IN_CHECK " << EXPTOSTRING(EXTEND_IN_CHECK) <<
"\n";
#endif
#ifdef EXTEND_RECAPTURE
std::cout << "\tEXTEND_RECAPTURE " << EXPTOSTRING(EXTEND_RECAPTURE)
<< "\n";
#endif
#ifdef MAXDEPTH
std::cout << "\tMAXDEPTH " << EXPTOSTRING(MAXDEPTH) << "\n";
#endif
#ifdef MAXPLY
std::cout << "\tMAXPLY " << EXPTOSTRING(MAXPLY) << "\n";
#endif
#ifdef MOVELIST_MAXSIZE
std::cout << "\tMOVELIST_MAXSIZE " << EXPTOSTRING(MOVELIST_MAXSIZE)
<< "\n";
#endif
#ifdef COLLECT_STATISTICS
std::cout << "\tCOLLECT_STATISTICS " <<
EXPTOSTRING(COLLECT_STATISTICS) << "\n";
#endif
#ifdef STATS_MOVELIST
std::cout << "\tSTATS_MOVELIST " << EXPTOSTRING(STATS_MOVELIST) <<
"\n";
#endif
#undef EXPTOSTRING
#undef EXPTOSTRING1
There is another header file that contains this:
/* $Id: config.h 1452 2007-10-30 16:11:59Z holger $
*
* HoiChess/config.h
*
* Copyright (C) 2004, 2005 Holger Ruckdeschel <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef CONFIG_H
#define CONFIG_H
/* Default size of main hash table */
#define DEFAULT_HASHSIZE "32M"
/* Default size of pawn hash table */
#define DEFAULT_PAWNHASHSIZE "4M"
/* Default size of evaluation cache */
#define DEFAULT_EVALCACHESIZE "4M"
/* Default location of opening book */
#define DEFAULT_BOOK "book.dat"
/* Use a single board in search tree, in connection with
Board::unmake_move().
* Otherwise, the board will be copied from node to node each time a
move is
* made. */
//#define USE_UNMAKE_MOVE
/* Use internal iterative deepening */
#define USE_IID
/* Use principal variation search */
#define USE_PVS
/* Use history table */
#define USE_HISTORY
/* Use killer heuristic */
#define USE_KILLER
/* Use null-move pruning */
#define USE_NULLMOVE
/* Use futility pruning */
#define USE_FUTILITYPRUNING
/* Use extended futility pruning */
#define USE_EXTENDED_FUTILITYPRUNING
/* Use razoring */
//#define USE_RAZORING
/* Use evaluation cache */
#define USE_EVALCACHE
/* Search extensions */
#define EXTEND_IN_CHECK
#define EXTEND_RECAPTURE
/* Maximum depth for full-width search */
#define MAXDEPTH 900
/* Maximum search tree depth (full-width + quiescence search) */
#define MAXPLY 1024
/* Maximum size of a Movelist */
#define MOVELIST_MAXSIZE 256
/* Collect statistics, e.g. hash table hits, cutoffs during search,
etc. */
#define COLLECT_STATISTICS
/* Collect statistics about maximum number of moves stored in a
movelist
* (expensive!) */
//#define STATS_MOVELIST
#endif // CONFIG_H
My Visual C++ compiler gives an error for any macro that does not have
a value defined such as:
#define USE_IID
Here is the list of errors coughed up:
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(19) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(19) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(22) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(22) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(25) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(25) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(28) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(28) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(31) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(31) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(34) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(34) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(37) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(37) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(43) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(43) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(46) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(46) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(49) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(49) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(61) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(61) :
error C2059: syntax error : '<<'
eval.cc
So my question is, is the compiler right to throw the errors, or am I
remembering how macros are supposed to operate incorrectly. Chapter
and verse from the current standard would be greatly appreciated.
P.S.
Works fine with GCC, but of course a compiler does not make the rules
-- even though it can extend them.
defined, but a value for the macro does not exist, it should be
evaluated as zero, but I can't find it in the standard. There is a
program called Hoichess, that has the following include file:
#define EXPTOSTRING1(x) #x
#define EXPTOSTRING(x) EXPTOSTRING1(x)
#ifdef DEFAULT_HASHSIZE
std::cout << "\tDEFAULT_HASHSIZE " << EXPTOSTRING(DEFAULT_HASHSIZE)
<< "\n";
#endif
#ifdef DEFAULT_PAWNHASHSIZE
std::cout << "\tDEFAULT_PAWNHASHSIZE " <<
EXPTOSTRING(DEFAULT_PAWNHASHSIZE) << "\n";
#endif
#ifdef DEFAULT_EVALCACHESIZE
std::cout << "\tDEFAULT_EVALCACHESIZE " <<
EXPTOSTRING(DEFAULT_EVALCACHESIZE) << "\n";
#endif
#ifdef DEFAULT_BOOK
std::cout << "\tDEFAULT_BOOK " << EXPTOSTRING(DEFAULT_BOOK) << "\n";
#endif
#ifdef USE_UNMAKE_MOVE
std::cout << "\tUSE_UNMAKE_MOVE " << EXPTOSTRING(USE_UNMAKE_MOVE) <<
"\n";
#endif
#ifdef USE_IID
std::cout << "\tUSE_IID " << EXPTOSTRING(USE_IID) << "\n";
#endif
#ifdef USE_PVS
std::cout << "\tUSE_PVS " << EXPTOSTRING(USE_PVS) << "\n";
#endif
#ifdef USE_HISTORY
std::cout << "\tUSE_HISTORY " << EXPTOSTRING(USE_HISTORY) << "\n";
#endif
#ifdef USE_KILLER
std::cout << "\tUSE_KILLER " << EXPTOSTRING(USE_KILLER) << "\n";
#endif
#ifdef USE_NULLMOVE
std::cout << "\tUSE_NULLMOVE " << EXPTOSTRING(USE_NULLMOVE) << "\n";
#endif
#ifdef USE_FUTILITYPRUNING
std::cout << "\tUSE_FUTILITYPRUNING " <<
EXPTOSTRING(USE_FUTILITYPRUNING) << "\n";
#endif
#ifdef USE_EXTENDED_FUTILITYPRUNING
std::cout << "\tUSE_EXTENDED_FUTILITYPRUNING " <<
EXPTOSTRING(USE_EXTENDED_FUTILITYPRUNING) << "\n";
#endif
#ifdef USE_RAZORING
std::cout << "\tUSE_RAZORING " << EXPTOSTRING(USE_RAZORING) << "\n";
#endif
#ifdef USE_EVALCACHE
std::cout << "\tUSE_EVALCACHE " << EXPTOSTRING(USE_EVALCACHE) <<
"\n";
#endif
#ifdef EXTEND_IN_CHECK
std::cout << "\tEXTEND_IN_CHECK " << EXPTOSTRING(EXTEND_IN_CHECK) <<
"\n";
#endif
#ifdef EXTEND_RECAPTURE
std::cout << "\tEXTEND_RECAPTURE " << EXPTOSTRING(EXTEND_RECAPTURE)
<< "\n";
#endif
#ifdef MAXDEPTH
std::cout << "\tMAXDEPTH " << EXPTOSTRING(MAXDEPTH) << "\n";
#endif
#ifdef MAXPLY
std::cout << "\tMAXPLY " << EXPTOSTRING(MAXPLY) << "\n";
#endif
#ifdef MOVELIST_MAXSIZE
std::cout << "\tMOVELIST_MAXSIZE " << EXPTOSTRING(MOVELIST_MAXSIZE)
<< "\n";
#endif
#ifdef COLLECT_STATISTICS
std::cout << "\tCOLLECT_STATISTICS " <<
EXPTOSTRING(COLLECT_STATISTICS) << "\n";
#endif
#ifdef STATS_MOVELIST
std::cout << "\tSTATS_MOVELIST " << EXPTOSTRING(STATS_MOVELIST) <<
"\n";
#endif
#undef EXPTOSTRING
#undef EXPTOSTRING1
There is another header file that contains this:
/* $Id: config.h 1452 2007-10-30 16:11:59Z holger $
*
* HoiChess/config.h
*
* Copyright (C) 2004, 2005 Holger Ruckdeschel <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef CONFIG_H
#define CONFIG_H
/* Default size of main hash table */
#define DEFAULT_HASHSIZE "32M"
/* Default size of pawn hash table */
#define DEFAULT_PAWNHASHSIZE "4M"
/* Default size of evaluation cache */
#define DEFAULT_EVALCACHESIZE "4M"
/* Default location of opening book */
#define DEFAULT_BOOK "book.dat"
/* Use a single board in search tree, in connection with
Board::unmake_move().
* Otherwise, the board will be copied from node to node each time a
move is
* made. */
//#define USE_UNMAKE_MOVE
/* Use internal iterative deepening */
#define USE_IID
/* Use principal variation search */
#define USE_PVS
/* Use history table */
#define USE_HISTORY
/* Use killer heuristic */
#define USE_KILLER
/* Use null-move pruning */
#define USE_NULLMOVE
/* Use futility pruning */
#define USE_FUTILITYPRUNING
/* Use extended futility pruning */
#define USE_EXTENDED_FUTILITYPRUNING
/* Use razoring */
//#define USE_RAZORING
/* Use evaluation cache */
#define USE_EVALCACHE
/* Search extensions */
#define EXTEND_IN_CHECK
#define EXTEND_RECAPTURE
/* Maximum depth for full-width search */
#define MAXDEPTH 900
/* Maximum search tree depth (full-width + quiescence search) */
#define MAXPLY 1024
/* Maximum size of a Movelist */
#define MOVELIST_MAXSIZE 256
/* Collect statistics, e.g. hash table hits, cutoffs during search,
etc. */
#define COLLECT_STATISTICS
/* Collect statistics about maximum number of moves stored in a
movelist
* (expensive!) */
//#define STATS_MOVELIST
#endif // CONFIG_H
My Visual C++ compiler gives an error for any macro that does not have
a value defined such as:
#define USE_IID
Here is the list of errors coughed up:
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(19) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(19) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(22) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(22) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(25) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(25) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(28) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(28) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(31) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(31) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(34) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(34) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(37) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(37) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(43) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(43) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(46) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(46) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(49) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(49) :
error C2059: syntax error : '<<'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(61) :
warning C4003: not enough actual parameters for macro 'EXPTOSTRING1'
e:\pgn\winboard-engines\hoichess-0.10.2\src\debug_printconfig.h(61) :
error C2059: syntax error : '<<'
eval.cc
So my question is, is the compiler right to throw the errors, or am I
remembering how macros are supposed to operate incorrectly. Chapter
and verse from the current standard would be greatly appreciated.
P.S.
Works fine with GCC, but of course a compiler does not make the rules
-- even though it can extend them.