C11 标准中添加了匿名结构,因此
typedef struct {
struct {int a, b};
int c;
} abc_struct;
是有效和标准的。使用 typedef 代替完整的结构声明是否也在标准范围内?例如:
typedef struct {
int a, b;
} ab_struct;
typedef struct {
ab_struct;
int c;
} abc_struct;
GCC 文档说这是一个 Plan 9 扩展,但是它可以在我尝试过的几个编译器中工作(包括 GCC ......)。通过我对标准本身的阅读,我认为这还可以,但这是一种很容易搞砸的仔细阅读。