• ISO/IEC 9899:2011 条款6.7.7——类型名


    6.7.7 类型名


    语法

    1、type-name:

            specifier-qualifier-list    abstract-declaratoropt

            abstract-declarator:

                pointer

                pointeropt    direct-abstract-declarator

        direct-abstract-declarator:

            (    abstract-declarator    )

            direct-abstract-declaratoropt    [    type-qualifier-listopt    assignment-expressionopt   ]

            direct-abstract-declaratoropt    [    static    type-qualifier-listopt    assignment-expression    ]

            direct-abstract-declaratoropt    [    type-qualifier-list    static    assignment-expression    ]

            direct-abstract-declaratoropt    [    *    ]

            direct-abstract-declaratoropt    (   parameter-type-listopt    )

    语义

    2、在若干个上下文中,有必要指定一个类型。这通过使用一个类型名来实现,这在语法上是对该类型的一个函数或一个对象的声明,此对象或函数省略了标识符。[注:正如语法所指定的那样,一个类型名中的空的圆括号被解释为“不带形参说明的函数”,而不是围在省略的标识符周围的冗余的圆括号。]

    3、例 以下构造:

    (a)    int

    (b)    int *

    (c)    int * [3]

    (d)    int (*) [3]

    (e)    int (*) [*]

    (f)    int * ()

    (g)    int (*) (void)

    (h)    int (* const []) (unsigned int, ...)

    分别命名了:(a)int,(b)指向int的指针,(c)带有三个指向int指针的数组,(d)指向一个带有三个int的数组的指针,(d)指向一个未指定int个数的可变长数组的指针,(f)不带有指定形参的,返回指向int的指针的函数,(g)指向不带有任何形参,返回一个int的函数的指针,(h)一个带有未知个数的,指向函数的常量指针的数组,函数的第一个参数类型是unsigned int,紧接着是未指定参数个数的形参,返回为一个int

  • 相关阅读:
    leetcode 203
    vim插件管理器vundle
    centos7看电影
    getopt
    iOS/object-c: 枚举类型 enum,NS_ENUM,NS_OPTIONS
    "ALView+PureLayout.h"
    UIPageViewController教程
    (Mac ox 10.11+) CocoaPods安装,卸载,使用说明
    CocoaPods集成到Xcode项目中的步骤
    label_设置行距、字距及计算含有行间距的label高度
  • 原文地址:https://www.cnblogs.com/zenny-chen/p/5012842.html
Copyright © 2020-2023  润新知