我一开始以为@是某个宏,但是并没有找到,如图这个定义说明了什么😫
C语言没有@这个运算符
ISO(国际标准化组织(International Standard Organization))将C语言分为三个不同类型集合: 函数类型、对象类型和不完全类型,具体说明如下所示:
C语言所有数据类型如下图所示:
在C99标准中对不完全类型描述如下:
The void type comprises an empty set of values; it is an incomplete type that cannot be completed. (C99 6.2.5/19)
An array type of unknown size is an incomplete type. It is completed, for an identifier of that type, by specifying the size in a later declaration (with internal or external linkage). A structure or union type of unknown content (as described in 6.7.2.3) is an incomplete type. It is completed, for all declarations of that type, by declaring the same structure or union tag with its defining content later in the same scope.(C99 6.2.5/22)
总结讲,C/C++中不完全类型有三种不同形式:void、未指定长度的数组以及具有非指定内容的结构和联合。void类型与其他两种类型不同,因为它是无法完成的不完全类型,并且它用作特殊函数返回和参数类型。
不完全类型是暂时没有完全定义好的类型,编译器不知道这种类型该占几个字节的存储空间,例如以下定义方式:
int str[]; //不完全类型数组str定义
…
int str[10]; //定义str数组完整的类型信息
再举个例子,在头*.h文件中声明结构:typedef struct __list *list_t;,最终在*.c文件中定义如下:
struct __list {
struct __list *prev;
struct __list *next;
viud *data;
};
此时,结构体变量*list_t就属于不完全类型,不完全类型不包含具体的类型信息,所以在未完整定义前不能通过sizeof来获知大小,并且不完全类型定义不适合局部变量。