宏定义时动态定义结构体

金刚豆

关注

阅读 68

2022-09-19


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)

0 0 举报