
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Edward Bishop
My question is, how can I eliminate the warning. Thanks in advance for any comments/advice.
# include <boost/preprocessor/library.hpp>
#define IS_SIMPLE(t) BOOST_PP_NOT_EQUAL(3, BOOST_PP_SEQ_SIZE(t)) #define PROPERTIES(t) BOOST_PP_SEQ_ELEM(2,t) #define HAS_COLOR(t) BOOST_PP_EQUAL(2, BOOST_PP_SEQ_ELEM(0, \ PROPERTIES(t))) #define COLOR(t) BOOST_PP_SEQ_ELEM(1, PROPERTIES(t))
#define FSIMPLE(a, s, i, t) \ BOOST_PP_SEQ_ELEM(0,t) is simple;
#define FCOMPLEX(a, s, i, t) \ BOOST_PP_SEQ_ELEM(0,t) is complex \ BOOST_PP_IF(HAS_COLOR(t), and color is COLOR(t) , ); ^^^ This is undefined behavior in C++. Should be:
#define FCOMPLEX(a, s, i, t) \ BOOST_PP_SEQ_ELEM(0,t) is complex \ BOOST_PP_EXPR_IF(HAS_COLOR(t), and color is COLOR(t)); \
#define FCHOICE(a, s, i, t) \ BOOST_PP_IF(IS_SIMPLE(t), \ FSIMPLE(a, s, i, t), \ FCOMPLEX(a, s, i, t))
The IF here is not lazy. Both the true and false cases are being evaluated, but then one is discarded. Should be: #define FCHOICE(a, s, i, t) \ BOOST_PP_IF(IS_SIMPLE(t), FSIMPLE, FCOMPLEX)(a, s, i, t) Regards, Paul Mensonides