宏“VER”在其他一些我无法更改的头文件中定义为“((u_long)1)”。
在我的代码中,我需要使用“test”和 VER 编写函数“test_1”。但是编译器报告了错误,因为它是“test_((u_long)1)”而不是“test_1”生成的。
我的问题是:如何编写宏以生成“test_1”?
提前致谢!
#define VER ((u_long)1) /* This is defined in some other header file which I can't change*/
#define paste(x, y, z) x ## y ## z
#define paste2(x, y, z) paste(x, y, z)
#define fcall(fname) paste2(fname, _, VER)
int test_1() {
return 0;
}
int main() {
fcall( test )();
return 0;
}