www.digitalmars.com         C & C++   DMDScript  

c++ - [Bug report] Whitespace prevents concatenation in preprocessor

Hi,

I've come across a few bugs in the preprocessor while converting the 
boost preprocessor library. This one is probably the most problematic.

In the preprocessor, if a macro argument contains whitespace then it 
prevents concatenation. The following example illustrates this:

     #define EMPTY
     #define CAT(x, y) CAT2(x, y)
     #define CAT2(x, y) x##y

     CAT(2 EMPTY, 2) // On DMC = 2 2
     CAT(2, EMPTY 2) // On DMC = 2 2

Both concatenations should expand to '22', but instead result in '2 2'.

Daniel
Aug 12 2004