What's special about R and L in the C++ preprocessor?

后端 未结 2 1519
后悔当初
后悔当初 2020-12-29 01:21

I ran the following code through the Visual Studio 2013 preprocessor. The output surprises me.

Contents of hello.cpp:

#define A(j) #j

A(A?)
A(B?)
A(         


        
2条回答
  •  萌比男神i
    2020-12-29 02:00

    This appears to be a bug in the MSVC preprocessor. The good news is that depending on how picky you are with your output, you can work around the issue by putting a space after the R or L.

    A(L ?p:q), // "L ?p:q"
    

提交回复
热议问题