----- Original Message -----
From: "Terje Slettebų" <[EMAIL PROTECTED]>

> To do that (without changing the Boost unit test code), I made a few
> forwarding macros, like this:
>
> #define BOOST_CHECK_EQUAL_CP(a,b)\
>
>
BOOST_CHECKPOINT("BOOST_CHECK_EQUAL("##BOOST_STRINGIZE(a)##","##BOOST_STRING
> IZE(b)##")");\
>   BOOST_CHECK_EQUAL(a,b)

1) BOOST_STRINGIZE(a) will not *legally* expand.  (It looks like the type of
thing that Metrowerks will expand anyway though.)  In any case,
token-pasting happens prior to rescanning the replacement list, so the
concatenations happen first.  Which...

2) ...is undefined behavior:  token-pasting yields multiple tokens.
Depending on how a particular preprocessor handles this, it might actually
cause BOOST_STRINGIZE to expand.  What you want is this:

Fix:  remove the concatenation operators.  This will yield adjacent strings
which will already get concatenated (and do you mean BOOST_PP_STRINGIZE?):

#define BOOST_CHECK_EQUAL_CP(a, b) \
    BOOST_CHECKPOINT(              \
        "BOOST_CHECK_EQUAL("       \
        BOOST_PP_STRINGIZE(a)      \
        ","                        \
        BOOST_PP_STRINGIZE(b)      \
        ")"                        \
    );                             \
    BOOST_CHECK_EQUAL(a, b)        \
    /**/

Regards,
Paul Mensonides

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to