复合文字的语法允许用大括号括起来的一系列值来初始化适当类型的自动对象。
The syntax for a compound literal allows a brace-enclosed series of values to be used to initialize an automatic object of the appropriate type.
复合文字和指定的初始化程序是非常好的代码可维护性特性。
Compound literals and designated initializers are a wonderful code maintainability feature. Compare these two code fragments.
而对于含有内置类型或复合类型成员的类,则通常应该定义他们自己的默认构造函数初始化这些成员。
Classes with members of built-in or compound type should usually define their own default constructors to initialize those members.
应用推荐