
Angus Leeming ha escrito:
Joaquín Mª López Muñoz wrote:
But I think it makes much more sense if BOOST_WORKAROUND itself includes the patch, so that instead of its current definition
# define BOOST_WORKAROUND(symbol, test) \ ((symbol != 0) && (1 % (( (symbol test) ) + 1)))
it looks like
# define BOOST_WORKAROUND(symbol, test) \ (defined(symbol) && (symbol != 0) && (1 % (( (symbol test) ) + 1)))
Anyone sees some problem with this?
That would be much nicer. However, reverting my patch and applying yours (below, to confirm I got it right :)), I get this when compiling my test case:
$ g++ -Wundef -Iboost/cvs -o trial trial.cpp In file included from boost/cvs/boost/random.hpp:36, from trial.cpp:1: boost/cvs/boost/random/linear_congruential.hpp:139:64: operator "defined" requires an identifier boost/cvs/boost/random/linear_congruential.hpp:139:64: missing '(' in expression
Oh, my bad. Seems like a problem with the replacement semantics of the preprocessor, turns out defined() can only be used inside an #if or #elif directive, and not inside a #define as I tried, hence the problem --and I guess that's the reason why my proposed patch wasn't there in the first place when BOOST_WORKAROUND was written. Probably Mr. Mensonides can clarify this issue further. Sorry for the noise, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo