函数类型的左值是否是可修改的左值?
Is an lvalue of a function type a modifiable lvalue or not?
6.3.2.1 C11 标准中的左值、数组和函数指示符说
A modifiable lvalue is an lvalue that
does not have array type, does not have an incomplete type, does not have a const-
qualified type, and if it is a structure or union, does not have any member (including,
recursively, any member or element of all contained aggregates or unions) with a const-
qualified type.
函数类型的左值是否是可修改的左值?
引用没有提到函数类型,但实际上,我认为函数类型的左值不是可修改的左值。 (数组类型的左值和函数类型的左值也有一些相似之处:都被转换为数组和函数的地址。)
谢谢。
Is an lvalue of a function type a modifiable lvalue or not?
该问题用词不当。根据定义,左值仅指定一个对象。在您引用的段落 (p1) 的前面,它指定
An lvalue is an expression (with an object type other than void) that potentially designates an object;
函数不计入对象的定义,因此没有函数类型的左值。
相反,函数类型有一个单独的类别。同样在第 6.3.2.1 节中,第 4 段:
A function designator is an expression that has function type. Except when it is the operand of the sizeof
operator, the _Alignof
operator, or the unary &
operator, a function designator with type ''function returning type'' is converted to an expression that has type ''pointer to function returning type''.
所以这个问题基本上没有实际意义。根据左值指定事物的表达式不必关心函数类型。相反,如果适用,表达式的规范将提及它如何使用“函数指示符”
I think an lvalue of a function type is not a modifiable lvalue
正确,但这又是因为根本不计入左值。
6.3.2.1 C11 标准中的左值、数组和函数指示符说
A modifiable lvalue is an lvalue that does not have array type, does not have an incomplete type, does not have a const- qualified type, and if it is a structure or union, does not have any member (including, recursively, any member or element of all contained aggregates or unions) with a const- qualified type.
函数类型的左值是否是可修改的左值?
引用没有提到函数类型,但实际上,我认为函数类型的左值不是可修改的左值。 (数组类型的左值和函数类型的左值也有一些相似之处:都被转换为数组和函数的地址。)
谢谢。
Is an lvalue of a function type a modifiable lvalue or not?
该问题用词不当。根据定义,左值仅指定一个对象。在您引用的段落 (p1) 的前面,它指定
An lvalue is an expression (with an object type other than void) that potentially designates an object;
函数不计入对象的定义,因此没有函数类型的左值。
相反,函数类型有一个单独的类别。同样在第 6.3.2.1 节中,第 4 段:
A function designator is an expression that has function type. Except when it is the operand of the
sizeof
operator, the_Alignof
operator, or the unary&
operator, a function designator with type ''function returning type'' is converted to an expression that has type ''pointer to function returning type''.
所以这个问题基本上没有实际意义。根据左值指定事物的表达式不必关心函数类型。相反,如果适用,表达式的规范将提及它如何使用“函数指示符”
I think an lvalue of a function type is not a modifiable lvalue
正确,但这又是因为根本不计入左值。