了解C11类型层次结构

 林淑芬若纯嘉友 发布于 2023-02-12 11:39

我想完全理解C11语言的类型层次结构并以图形方式呈现它(树形图将是完美的).该标准没有提供任何关于这个问题的数字 - 有30个点描述了它们之间的各种类型和关系.我想画它.

我的尝试始于获得ISO/IEC 9899:201x委员会草案N1570并从文件第6.2.5节中提取所有必要的陈述.然后,我开始以树的形式重新安排知识.让我分两步介绍我的工作.

第1步:第1-15点

提取的知识(第6.2.5节+指定生产内的点):

1 种类型 = 对象类型 + 函数类型 ;

4个标准符号整型 = signed char,short int,int,long int,long long int;

4个有符号整数类型 =标准有符号整数类型+ 扩展有符号整数类型 ;

6个标准无符号整型 = _Bool,unsigned char,unsigned short int,unsigned int,unsigned long int,unsigned long long int;

6个无符号整数类型 =标准无符号整数类型+ 扩展无符号整数类型 ;

7种标准整数类型 =标准有符号整数类型+标准无符号整数类型;

7个扩展整数类型 =扩展有符号整数类型+扩展无符号整数类型;

10种实浮点类型 = float,double,long double;

11种复杂类型 = float _Complex,double _Complex,long double _Complex;

12种浮动类型 =真正的浮动类型+复杂类型;

14种基本类型 = char+有符号整数类型+无符号整数类型+浮点类型;

15种字符类型 = 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

第2步:第16-24点

其余的陈述:

16个枚举类型 ;

17个整数类型 = char+有符号整数类型+无符号整数类型+枚举类型;

17个真实类型 =整数类型+实际浮动类型;

18种算术类型 =整数类型+浮动类型;

20个派生类型 = 数组类型,结构类型,联合类型,函数类型,指针类型,原子类型 ;

21个标量类型 =算术类型+指针类型;

21个聚合类型 =数组类型+结构类型;

24个派生的声明符类型 =数组类型+函数类型+指针类型.

最终的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

现在我需要减少结构(理想情况下是单个树)或找到一种更难以表示关系的方法.我想为C11打字系统提供一张漂亮的笔记本.有任何想法吗?

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有