函数的名称。它是指向该函数的指针吗?
The name of a function. is it a pointer to that function?
当我们使用函数名传递参数时,我们是在使用指向该函数的指针吗?
示例:
int foo(int a, int b);
int main(void)
{
int a = foo(1,3); //foo() it's a pointer to the function foo()?
return 0;
}
您要查找的术语是功能指示符。它不是 pointer 类型,但大多数时候,它是 converted to one.
引用 C11
标准,章节 §6.3.2.1,(强调我的)
A function designator is an expression that has function type. Except when it is the
operand of the sizeof
operator, the _Alignof
operator,65) 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’’.
相关,来自规范的 "function call" 部分,第 6.5.2.2 章
The expression that denotes the called function 92) shall have type pointer to function
returning void or returning a complete object type other than an array type.
这告诉我们,在函数调用中,指示符实际上被转换为指针。
当我们使用函数名传递参数时,我们是在使用指向该函数的指针吗?
示例:
int foo(int a, int b);
int main(void)
{
int a = foo(1,3); //foo() it's a pointer to the function foo()?
return 0;
}
您要查找的术语是功能指示符。它不是 pointer 类型,但大多数时候,它是 converted to one.
引用 C11
标准,章节 §6.3.2.1,(强调我的)
A function designator is an expression that has function type. Except when it is the operand of the
sizeof
operator, the_Alignof
operator,65) 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’’.
相关,来自规范的 "function call" 部分,第 6.5.2.2 章
The expression that denotes the called function 92) shall have type pointer to function returning void or returning a complete object type other than an array type.
这告诉我们,在函数调用中,指示符实际上被转换为指针。