如何在包含点(成员访问运算符)的 C/C++ 宏参数中使用?
例子:
#define M(obj,y) obj.y##x
struct S { struct {int x;} c; int x; };
S s;
s.c.x = 1;
s.x = 2;
M(s,) // works, 2 (resolves to s.x)
M(s,c.) // error: pasting formed '.x', an invalid preprocessing token
如何M(s,c.)
解决s.c.x
?
谢谢您的帮助!