Boost logo

Boost :

Subject: Re: [boost] [preprocessor]BOOST_PP_CHECK_2 with wrong number args
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-08-24 17:34:42


On 8/24/2011 2:15 PM, Larry Evans wrote:
> boost/preprocessor/detail/check.hpp in boost version 1.47.0 contains:
>
> # if ~BOOST_PP_CONFIG_FLAGS()& BOOST_PP_CONFIG_MSVC()&&
> ~BOOST_PP_CONFIG_FLAGS()& BOOST_PP_CONFIG_DMC()
> # define BOOST_PP_CHECK_D(x, type)
> BOOST_PP_CHECK_1(BOOST_PP_CAT(BOOST_PP_CHECK_RESULT_, type x))
> # define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
> # define BOOST_PP_CHECK_2(res, _) res
> # elif BOOST_PP_CONFIG_FLAGS()& BOOST_PP_CONFIG_MSVC()
>
> The above shows BOOST_PP_CHECK_2 is called with 1 argument
> on rhs of BOOST_CHECK_1; yet, the arity is 2, as shown
> on the next line.
>
> This results in the errors reported here:
>
> http://article.gmane.org/gmane.comp.lib.boost.devel/222795
>
> when that line is changed to:
>
> # define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk,_)
>
> the reported error goes away; however, several other errors
> occur about too many instead of too few arguments passed to
> BOOST_PP_CHECK_2.
>
> Is this a BOOST_PP bug? If not; how can the errors reported
> in:
>
> http://article.gmane.org/gmane.comp.lib.boost.devel/222795
>
> be avoided?

I believe it is allowable because of placeholder expressions, but this
may have been because of C99, whereas a preprocessor that does not
support C99 may not work.

BTW, nothing has changed with BOOST_PP_CHECK with Boost 1.47, as the
code has appeared the way it is for a long time.

What compiler are you using ? Is there a C99 or a C++0x mode you can
turn on in the command line somehow ?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk