|
Boost Users : |
From: scleary_at_[hidden]
Date: 2002-09-27 08:19:03
> From: zhangwusheng [mailto:yg-boost-users_at_[hidden]]
>
> Hi,all,
> In file suffix.hpp there are lines:
>
> #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
> #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
> #define BOOST_DO_JOIN2( X, Y ) X##Y
>
>
> why donot we define such macro instead:
> #define BOOST_JOIN( X, Y ) X##Y
The idea behind BOOST_JOIN is to force the preprocessor to scan the macro
parameters for replacement before merging the results with ##. So, it
changes the meaning if one of the parameters is a macro:
#define Z_BOOST_JOIN(X, Y) X##Y
Z_BOOST_JOIN(id_, __LINE__) // Expands to "id___LINE__"
BOOST_JOIN(id_, __LINE__) // Expands to "id_13" if __LINE__ is 13
However, I'm not sure why BOOST_DO_JOIN2 is used; it seems to me that only
one layer of indirection should work. I assume it's to work around some
compiler's non-conforming preprocessor.
-Steve
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