6.5.4 Cast operators

Previous Table of Contents "New C Standard" commentary

1133

cast-expression:
                unary-expression
                ( type-name ) cast-expression

1134 Unless the type name specifies a void type, the type name shall specify qualified or unqualified scalar type and the operand shall have scalar type.

1135 Conversions that involve pointers, other than where permitted by the constraints of 6.5.16.1, shall be specified by means of an explicit cast.

1136 Preceding an expression by a parenthesized type name converts the value of the expression to the named type.

1137 This construction is called a cast.86)

1138 A cast that specifies no conversion has no effect on the type or value of an expression.87)

1139 Forward references: equality operators (6.5.9), function declarators (including prototypes) (6.7.5.3), simple assignment (6.5.16.1), type names (6.7.6).

1140 86) A cast does not yield an lvalue.

1141 Thus, a cast to a qualified type has the same effect as a cast to the unqualified version of the type.

1142 87) If the value of the expression is represented with greater precision or range than required by the type named by the cast (6.3.1.8), then the cast specifies a conversion even if the type of the expression is the same as the named type.

Next

Created at: 2008-01-30 02:39:42 The text from WG14/N1256 is copyright © ISO