Boost logo

Boost :

From: Mark Borgerding (mborgerding_at_[hidden])
Date: 2000-02-24 18:31:11


john maddock <john_maddoc-_at_[hidden]> wrote:
original article:http://www.egroups.com/group/boost/?start=2265

> #define BOOST_CT_ASSERT( B ) enum { BOOST_JOIN(_boost_assert_enum_,
> __LINE__) = sizeof(::boost::ct_assert<(B)>) }
> //#define BOOST_CT_ASSERT(condition) struct { int : (condition) ? 0 :
-1; }
>
> #define BOOST_DO_JOIN( X, Y ) X ## Y
> #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )

I am trying to get this to work on VC6, but I keep getting errors that
seem to suggest that the macro expansion of __LINE__ and the
token-pasting are happening in reverse order. I installed Visual
Studio SP3, but it didn't help.

What are you doing differently from me?

I boiled the macros down a bit, and cannot get the following to compile
on VC.

#define TEST_DECLARATION int JOIN(unique_,__LINE__ ) = 0
#define DO_JOIN(X,Y) X##Y
#define JOIN(X,Y) DO_JOIN(X,Y)

int main()
{
        TEST_DECLARATION;
        return 0;
}

It works fine on g++ 2.95. And when I use the /E (preprocess to
stdout) option for VC, it looks right too:

int main()
{
        int unique_7 = 0;
        return 0;
}

I am really frustrated by this. Does the C standard dictate which
order the preprocessor must go? I don't have access to this document
and the C++ standard doesn't give any hints.


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