- 论坛徽章:
- 0
|
本帖最后由 幻の上帝 于 2011-08-24 21:01 编辑
Undefined behavior.
ISO C99:
4/2 If a ‘‘shall’’ or ‘‘shall not’’ requirement that appears outside of a constraint is violated, the behavior is undefined. Undefined behavior is otherwise indicated in this International Standard by the words ‘‘undefined behavior’’ or by the omission of any explicit definition of behavior. There is no difference in emphasis among these three; they all describe ‘‘behavior that is undefined’’.
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 54) 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’’.
54) Because this conversion does not occur, the operand of the sizeof operator remains a function designator and violates the constraint in 6.5.3.4.
6.5.3.4/2 The sizeof operator shall not be applied to an expression that has function type or an incomplete type, to the parenthesized name of such a type, or to an lvalue that designates a bit-field object.
PS.C89也一样。
PS2.C++直接ill-formed了所以报错。
PS3.至今买不起。 |
|