该部分6.5.2.5/4
提供了有关postfix-expression
表单的说明( type-name ) { initializer-list }
。这里是:
如果类型名称指定一个未知大小的数组,则大小由 6.7.9 中指定的初始化列表确定,复合文字的类型是完整数组类型的类型。否则(当类型名称指定对象类型时),复合文字的类型是类型名称指定的类型。无论哪种情况,结果都是
lvalue
.
我不明白措辞the type of the compound literal
。文字怎么可能有类型?对应的未命名对象的类型是指的the type of the compound literal
吗?
例如
long long *longs = (long long []) {1333, 3123, 3, 122};
这里initializer-list
用于初始化类型为 的未命名对象long long [4]
。
也不清楚 . 的目的是什么In either case, the result is an lvalue
。当在右操作数上使用时assignment-expression
,lvalue conversion
它不再是左值。