6.5.4 Cast operators

Syntax

1

cast-expression:

unary-expression

( type-name ) cast-expression

Constraints

2

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.

3

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.

Semantics

4

Preceding an expression by a parenthesized type name converts the value of the expression to the named type. This construction is called a cast.[1] A cast that specifies no conversion has no effect on the type or value of an expression.

5

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.

Forward References

Footnotes