关于C11标准6.5.2.2 p9条款意图及compatible type相关问题的技术问询
关于C11标准6.5.2.2 p9条款意图及兼容类型相关问题的技术问询
我最近在研读C11标准的6.5.2.2第9款时,有一些疑问想和大家探讨:
If the function is defined with a type that is not compatible with the type (of the expression) pointed to by the expression that denotes the called function, the behavior is undefined.
据我所知,函数调用表达式的行为取决于调用点处被调用函数的原型是否在作用域内。
那对于条款里提到的“表示被调用函数的表达式所指向的(表达式的)类型”,这个被调用函数的表达式所指向的类型不就是函数类型(也就是函数声明的类型)吗?
说实话,在我看来,这条标准的意图不就是要求函数声明必须与定义兼容吗?
另外,标准6.2.7第2款也已经提到:
All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined.
备注:内容来源于stack exchange,提问作者user24723440
相关产品推荐
相关产品推荐

