宏定义求助
#define FUNCTION(name, a) int fun_##name(int x) { return (a)*x;}这句代码什么意思,谢谢 sh-4.4$ cat main.c
//#include <stdio.h>
#define FUNCTION(name, a) int fun_##name(int x) { return (a)*x;}
FUNCTION(Test, 10)
int main(void)
{
printf("%d\n", fun_Test(123));
return 0;
}
sh-4.4$ gcc -E main.c
# 1 "main.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "main.c"
int fun_Test(int x) { return (10)*x;}
int main(void)
{
printf("%d\n", fun_Test(123));
return 0;
}
sh-4.4$
FUNCTION(Test, 10)
预处理后就成了
int fun_Test(int x) { return (10)*x;} https://blog.csdn.net/baidu_33850454/article/details/79363033
页:
[1]