英语不是我的母语;因此我展示了要描述的代码。
#define concat_temp(x, y) x##y
#define concat(x, y) concat_temp(x, y)
#define BAR 2
int main() {
concat_temp(FOO, BAR)
concat(FOO, BAR)
}
Run Code Online (Sandbox Code Playgroud)
当我执行时clang -E
,宏被扩展为
int main() {
FOOBAR
FOO2
}
Run Code Online (Sandbox Code Playgroud)
谁能向我解释为什么concat_temp
不能扩展bar
to2
但concat
成功了?