[preprocessor] PP_CAT with symbols

Hello all, I just want to confirm that the following: BOOST_PP_CAT(old_size =, =) correctly (and always) expands to: old_size == I tested it on MSVC and GCC and it works. Plus from GCC documentation says about ##: Usually both will be identifiers, or one will be an identifier and the other a preprocessing number. When pasted, they make a longer identifier. This isn't the only valid case. It is also possible to concatenate two numbers (or a number and a name, such as 1.5 and e3) into a number. Also, multi-character operators such as += can be formed by token pasting. http://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Concatenation.html I am asking because ## has some limitation (x ## = is not valid, etc) so I want to confirm my understanding is correct. Thanks a lot. --Lorenzo -- View this message in context: http://boost.2283326.n4.nabble.com/boost-preprocessor-PP-CAT-with-symbols-tp... Sent from the Boost - Dev mailing list archive at Nabble.com.

On 24/09/2011 19:54, lcaminiti wrote:
Hello all,
I just want to confirm that the following:
BOOST_PP_CAT(old_size =, =)
correctly (and always) expands to:
old_size ==
I tested it on MSVC and GCC and it works. Plus from GCC documentation says about ##:
## can be used to concatenates two tokens into a single token.
I am asking because ## has some limitation (x ## = is not valid, etc) so I want to confirm my understanding is correct.
x= is not a valid token. What you want is just the sequence of the two tokens x and =, which is written as x =
participants (3)
-
lcaminiti
-
Mathias Gaunard
-
Matt Calabrese