problem with preprocessing library

Using the Boost preprocessor library, I'm getting an unexpected diagnostic from 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. Is my use of the preprocessor library incorrect? Ellis Cohen ======================================================================== 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_CAT(d_,PPV_NAME(I))(BOOST_PP_CAT(other.d_,PPV_NAME(I))) BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _) #undef BOOST_PP_DEF ======================================================================== Compiler command: /opt/aCC/bin/aCC \ -Iboost_includes \ -Wc,-ansi_for_scope,on \ -Aa \ +inst_compiletime +inst_v \ -E -c Isrc/boost_bug.C -o boost_bug.o ======================================================================== Compiler output: Warning (anachronism) 823: "Isrc/boost_bug.C", line 18 # Redundant preprocessing concatenation operation results in two valid preprocessing tokens. Depending on this implementation defined behavior will result in non-portable code. BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _) ^^^^^^^^^^^^^^^ Warning (anachronism) 823: "Isrc/boost_bug.C", line 18 # Redundant preprocessing concatenation operation results in two valid preprocessing tokens. Depending on this implementation defined behavior will result in non-portable code. BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _) ^^^^^^^^^^^^^^^ Warning (anachronism) 823: "Isrc/boost_bug.C", line 18 # Redundant preprocessing concatenation operation results in two valid preprocessing tokens. Depending on this implementation defined behavior will result in non-portable code. BOOST_PP_REPEAT(FOO_CNT, BOOST_PP_DEF, _) ^^^^^^^^^^^^^^^ #line 1 "Isrc/boost_bug.C" #line 1 "boost_includes/boost/preprocessor/cat.hpp" #line 2 "Isrc/boost_bug.C" #line 1 "boost_includes/boost/preprocessor/comma_if.hpp" #line 1 "boost_includes/boost/preprocessor/comma.hpp" #line 17 "boost_includes/boost/preprocessor/comma_if.hpp" #line 1 "boost_includes/boost/preprocessor/empty.hpp" #line 18 "boost_includes/boost/preprocessor/comma_if.hpp" #line 1 "boost_includes/boost/preprocessor/if.hpp" #line 1 "boost_includes/boost/preprocessor/logical/bool.hpp" #line 17 "boost_includes/boost/preprocessor/if.hpp" #line 1 "boost_includes/boost/preprocessor/tuple/elem.hpp" #line 18 "boost_includes/boost/preprocessor/if.hpp" #line 19 "boost_includes/boost/preprocessor/comma_if.hpp" #line 3 "Isrc/boost_bug.C" #line 1 "boost_includes/boost/preprocessor/repeat.hpp" #line 4 "Isrc/boost_bug.C" #line 18 d_some_value( other.d_some_value) , d_some_other_value( other.d_some_other_value) , d_some_other_other_value( other.d_some_other_other_value)

I can get this to work with std::bind1st, but not with boost::bind. Why? // compiles std::bind1st(std::multiplies<int>(), 10); // does not boost::bind(std::multiplies<int>(), _1, 10); I'm using VC++ 6.0. Jeff

On Friday 30 August 2002 09:56 am, Jeff Faust wrote:
I can get this to work with std::bind1st, but not with boost::bind. Why?
// compiles std::bind1st(std::multiplies<int>(), 10);
// does not boost::bind(std::multiplies<int>(), _1, 10);
I'm using VC++ 6.0.
Jeff
You need to give bind the return type when using a function object on VC++ 6.0, e.g., boost::bind<int>(std::multiplies<int>(), _1, 10); Doug
participants (3)
-
Douglas Gregor
-
Ellis Cohen
-
Jeff Faust