6.5.4 Cast operators

Previous Table of Contents

1123

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

1124 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.

1125 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.

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

1127 This construction is called a cast.86)

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

1129 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).

1130 86) A cast does not yield an lvalue.

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

1132 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: 2005-06-29 02:18:59 The text from WG14/N1124 is copyright © ISO