//testmacro.cpp
#define DECLARE_ELEMENT(type, value, commit)\
type = value;
#define DECLARE_COMMON_ELEMENTS(F, type , val)\
F(type, val, int)
#include <stdio.h>
#define xxxx(type) DECLARE_COMMON_ELEMENTS(DECLARE_ELEMENT,type,1)
int main()
{
int type =3;
xxxx(type);
printf("type = %d\n",type);
return 0;
}
宏函数作为宏的入参
于 2022-12-13 17:48:16 首次发布