当前位置:网站首页>Define structure dynamically when macro is defined

Define structure dynamically when macro is defined

2022-06-21 14:21:00 JDSH0224

struct packet {
	char type;
};
#define TAILQ_HEAD(name, type)						\
struct name {								\
	struct type *tqh_first;	/* first element */			\
	struct type **tqh_last;	/* addr of last next element */		\
}
void test()
{
    TAILQ_HEAD(, packet) outgoing; // The label of the structure is NULL
    TAILQ_HEAD(xxx, packet) outgoing1; // The label of the structure is xxx
}

 

 

 

原网站

版权声明
本文为[JDSH0224]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202221426020645.html