Krz*_*icz 34 c standards types language-lawyer c11
我想完全理解C11语言的类型层次结构并以图形方式呈现它(树形图将是完美的).该标准没有提供任何关于这个问题的数字 - 有30个点描述了它们之间的各种类型和关系.我想画它.
我的尝试始于获得ISO/IEC 9899:201x委员会草案N1570并从文件第6.2.5节中提取所有必要的陈述.然后,我开始以树的形式重新安排知识.让我分两步介绍我的工作.
提取的知识(第6.2.5节+指定生产内的点):
signed char
,short int
,int
,long int
,long long int
;_Bool
,unsigned char
,unsigned short int
,unsigned int
,unsigned long int
,unsigned long long int
;float
,double
,long double
;float _Complex
,double _Complex
,long double _Complex
;char
+有符号整数类型+无符号整数类型+浮点类型;char
,signed char
,unsigned char
.由此产生的结构:
types
object types
function types
basic types
char
s?gned integer types
standard s?gned integer types
signed char, short int, int, long int, long long int
extended s?gned integer types
uns?gned integer types
standard uns?gned integer types
_Bool, unsigned char, unsigned short int, unsigned int,
unsigned long int, unsigned long long int
extended uns?gned integer types
floating types
real floating types
float, double, long double
complex types
float _Complex, double _Complex, long double _Complex
standard integer types
standard s?gned integer types
standard uns?gned integer types
extended integer types
extended s?gned integer types
extended uns?gned integer types
character types
char, signed char, unsigned char
Run Code Online (Sandbox Code Playgroud)
其余的陈述:
char
+有符号整数类型+无符号整数类型+枚举类型;最终的C11型系统结构:
types
object types
function types
basic types
char
s?gned integer types
standard s?gned integer types
signed char, short int, int, long int, long long int
extended s?gned integer types
uns?gned integer types
standard uns?gned integer types
_Bool, unsigned char, unsigned short int, unsigned int,
unsigned long int, unsigned long long int
extended uns?gned integer types
floating types
real floating types
float, double, long double
complex types
float _Complex, double _Complex, long double _Complex
standard integer types
standard s?gned integer types
standard uns?gned integer types
extended integer types
extended s?gned integer types
extended uns?gned integer types
character types
char, signed char, unsigned char
real types
integer types
char
s?gned integer types
standard s?gned integer types
signed char, short int, int, long int, long long int
extended s?gned integer types
uns?gned integer types
standard uns?gned integer types
_Bool, unsigned char, unsigned short int, unsigned int,
unsigned long int, unsigned long long int
extended uns?gned integer types
enumeration types
real floating types
float, double, long double
scalar types
arithmetic types
integer types
char
s?gned integer types
standard s?gned integer types
signed char, short int, int, long int, long long int
extended s?gned integer types
uns?gned integer types
standard uns?gned integer types
_Bool, unsigned char, unsigned short int, unsigned int,
unsigned long int, unsigned long long int
extended uns?gned integer types
enumeration types
floating types
real floating types
float, double, long double
complex types
float _Complex, double _Complex, long double _Complex
pointer types
derived types
array types
structure types
un?on types
function types
pointer types
atomic types
aggregate types
array type
structure type
derived declarator types
array type
structure type
pointer type
Run Code Online (Sandbox Code Playgroud)
现在我需要减少结构(理想情况下是单个树)或找到一种更难以表示关系的方法.我想为C11打字系统提供一张漂亮的笔记本.有任何想法吗?
Krz*_*icz 16
通过删除/减少不太重要的节点并委托一些冗余/辅助信息通过其他方式呈现,可以简化由问题的第二步产生的C11类型的混乱结构.
我提出了以下五步算法:
生成的C11类型系统摘要如下所示:
引入灰色笔划/区域以增加树的可读性.
类型摘要不包括"类型声明完整性"的概念,因为它是在翻译单元内的特定点观察到的状态.在运行时,所有对象和函数都是完整类型的实例.该void
类型是一个例外,但是,作为一个非类型(或指针的情况下的任何类型),它有意地从图中排除.
的const
,volatile
,restrict
和_Atomic
是类型限定符违背其中,类型说明符的派生类型,不能被递归地应用.这些的任何组合可以预先添加任何类型定义(只要它是有意义的).因此,将它们包括在图中会使其复杂化,同时不会引入任何合适的信息.表观例外使得_Atomic (type)
构建体,其是考虑到作为一个类型说明符的原子类型 -的一个派生类型的C11标准中列出.