Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-02-12 13:25:59


Hi all,

I don't think that reentrancy mechanism is working for this macro. Is it
supposed to?

The following example illustrates my problem (I tried both automatic and
manual methods):

#include <boost/preprocessor/seq/for_each_i.hpp>

#define seq\
    ((1)(2)(3))\
    ((4)(5)(6))\
    ((7)(8)(9))

#define MACRO(r, data, i, elem)\
    BOOST_PP_SEQ_FOR_EACH_I(MACRO2, ~, elem)

#define MACRO1(r, data, i, elem)\
    BOOST_PP_SEQ_FOR_EACH_I_R(r, MACRO2, ~, elem)

#define MACRO2(r, data, i, elem)\
    elem

BOOST_PP_SEQ_FOR_EACH_I(MACRO, ~, seq)
BOOST_PP_SEQ_FOR_EACH_I(MACRO1, ~, seq)

Both preprocessors I tried, VC71 and GCC 3.4.2, produce the same result:

BOOST_PP_SEQ_FOR_EACH_I(MACRO2, ~, (1)(2)(3) )
BOOST_PP_SEQ_FOR_EACH_I(MACRO2, ~, (4)(5)(6) )
BOOST_PP_SEQ_FOR_EACH_I(MACRO2, ~, (7)(8)(9) )

BOOST_PP_SEQ_FOR_EACH_I_M(3, (MACRO2, ~, (1)(2)(3) (nil), 0))
BOOST_PP_SEQ_FOR_EACH_I_M(4, (MACRO2, ~, (2)(3) (nil), 1))
BOOST_PP_SEQ_FOR_EACH_I_M(5, (MACRO2, ~, (3) (nil), 2))
BOOST_PP_SEQ_FOR_EACH_I_M(4, (MACRO2, ~, (4)(5)(6) (nil), 0))
BOOST_PP_SEQ_FOR_EACH_I_M(5, (MACRO2, ~, (5)(6) (nil), 1))
BOOST_PP_SEQ_FOR_EACH_I_M(6, (MACRO2, ~, (6) (nil), 2))
BOOST_PP_SEQ_FOR_EACH_I_M(5, (MACRO2, ~, (7)(8)(9) (nil), 0))
BOOST_PP_SEQ_FOR_EACH_I_M(6, (MACRO2, ~, (8)(9) (nil), 1))
BOOST_PP_SEQ_FOR_EACH_I_M(7, (MACRO2, ~, (9) (nil), 2))

Which, I think, indicates that reentrancy is not working.

Am I missing something?

Regards,
Arkadiy


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