C宏中“ ##”是什么意思?
作者:互联网
这个问题已经在这里有了答案: > What are the applications of the ## preprocessor operator and gotchas to consider? 13个
> The ## operator in C 7个
下面的“ ##”是什么意思?
#define CC_SYNTHESIZE(varType, varName, funName)\
protected: varType varName;\
public: inline varType get##funName(void) const { return varName; }\
public: inline void set##funName(varType var){ varName = var; }
解决方法:
运算符##连接两个参数,它们之间不留空格:
例如
#define glue(a,b) a ## b
glue(c,out) << "test";
这也将转换为:
cout << "test";
标签:c-3,c,c-preprocessor 来源: https://codeday.me/bug/20191011/1894730.html