From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-10-08 17:12:01
----- Original Message -----
From: "Jaakko Jarvi" <jajarvi_at_[hidden]>
Sent: Tuesday, October 08, 2002 1:39 PM
Subject: [boost] Preprocessor: compiler/library/user bug?
> Posted on behalf of Ellis Cohen.
> I'm getting an unexpected diagnostic message when using the
> Boost preprocessor library. The compiler environment is the
> HP-UX C++ compiler (aCC, version "HP ANSI C++ B3910B A.03.34").
> The generated output -- see the last line of "Compiler output",
> below -- *is* correct. I'm using Boost_1_28_0.
> Can someone please help me answer whether
> . my use of the preprocessor library is incorrect
As far as 1.28 goes, it looks fine to me.
> . there a bug in aCC
> . there is a problem in the preprocessor library?
I can't say for sure way back at 1.28.
> Thank you.
> Ellis Cohen
> Example code fragment triggering the diagnostic:
> #include <boost/preprocessor/cat.hpp>
> #include <boost/preprocessor/comma_if.hpp>
> #include <boost/preprocessor/repeat.hpp>
> #include <boost/preprocessor/tuple/elem.hpp>
> #define FOO0 (0, double, some_value)
> #define FOO1 (0, double, some_other_value)
> #define FOO2 (0, double, some_other_other_value)
> #define FOO_CNT 3
> #define PPV(I) FOO##I
> #define PPV_FLAG(I) BOOST_PP_TUPLE_ELEM(3,0,PPV(I))
> #define PPV_TYPE(I) BOOST_PP_TUPLE_ELEM(3,1,PPV(I))
> #define PPV_NAME(I) BOOST_PP_TUPLE_ELEM(3,2,PPV(I))
> #define BOOST_PP_DEF(I,_) BOOST_PP_COMMA_IF(I)
> BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _)
> #undef BOOST_PP_DEF
All of this looks fine except it needs to be updated slightly to work with 1.29.
As far as the 1.28 interface is concerned, the code is fine. What happens when
you do this by itself:
#define X(I) BOOST_PP_CAT(other.d_,PPV_NAME(I))
X(0) // ?
To update the above code to 1.29, you have to add an extra parameter to
BOOST_PP_DEF in the above (then you can ignore it):
#define BOOST_PP_DEF(Z,I,_) BOOST_PP_COMMA_IF(I) ...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk