宏参数的目的是什么似乎没用(参见下面的代码)

Joh*_* Li 0 c macros bsd

在BSD系统的头文件queue.h中,有以下宏

#define TAILQ_ENTRY(type, qual)\
struct {\
    qual type *tqe_next;        /* next element */\
    qual type *qual *tqe_prev;  /* address of previous next element */\
}
Run Code Online (Sandbox Code Playgroud)

根据上面的定义,人们应该使用它

struct foo {
    TAILQ_ENTRY(struct foo, ) my_list;
    //some data here
};
Run Code Online (Sandbox Code Playgroud)

我的问题是:这里的宏参数"qual"的目的是什么,似乎在代码生成中没有任何作用.

Sou*_*osh 5

好吧,在您的使用中,也许它没有使用,但可以像一个电话一样打电话

struct foo {
TAILQ_ENTRY(struct foo, ) my_list;
TAILQ_ENTRY(struct foo, const) my_list_too;
//some data here
};
Run Code Online (Sandbox Code Playgroud)

consttype-qualifier 在哪里?

类型限定符可以是的const,restrict,volatile_Atomic.