0
点赞
收藏
分享

微信扫一扫

宏定义时动态定义结构体

金刚豆 2022-09-19 阅读 68


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; //结构体的标签为NULL
TAILQ_HEAD(xxx, packet) outgoing1; //结构体的标签为xxx
}

 

 

 

举报

相关推荐

0 条评论