Boost logo

Boost Users :

Subject: [Boost-users] Boost::preprocess __VAR_ARGS__ compile fail
From: garthh (garthh_at_[hidden])
Date: 2014-02-11 01:55:02


This simple piece of code doesn't compile for me in boost 1.54 on MacOSX:

#include <boost/preprocessor.hpp>
#define debugprintf(...) \
        printf(BOOST_PP_SEQ_ELEM(0, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)))
main ()
{
        debugprintf("test");
}

I've spent ages on it without success. Any suggestions would be greatly
appreciated!

Compile output:

error: too few arguments provided to function-like macro invocation
        debugprintf("boost test");
        ^
main.cpp:15:17: note: expanded from macro 'debugprintf'
fprintf(stderr, BOOST_PP_SEQ_ELEM(0,
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)));
\
                ^
/usr/local/Boost/1.54/include/boost/preprocessor/seq/elem.hpp:22:39: note:
expanded from macro 'BOOST_PP_SEQ_ELEM'
# define BOOST_PP_SEQ_ELEM(i, seq) BOOST_PP_SEQ_ELEM_I(i, seq)
                                      ^
/usr/local/Boost/1.54/include/boost/preprocessor/seq/elem.hpp:41:45: note:
expanded from macro 'BOOST_PP_SEQ_ELEM_I'
# define BOOST_PP_SEQ_ELEM_I(i, seq)
BOOST_PP_SEQ_ELEM_II(BOOST_PP_SEQ_ELEM_ ## i seq)
                                            ^
/usr/local/Boost/1.54/include/boost/preprocessor/seq/elem.hpp:43:62: note:
expanded from macro 'BOOST_PP_SEQ_ELEM_II'
# define BOOST_PP_SEQ_ELEM_II(im) BOOST_PP_SEQ_ELEM_III(im)
                                                             ^
main.cpp:21:2: error: use of undeclared identifier 'BOOST_PP_SEQ_ELEM_III'
        debugprintf("boost test");

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-preprocess-VAR-ARGS-compile-fail-tp4659258.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net