|
2930 | 2930 | \begin{note}
|
2931 | 2931 | The \tcode{>} token following the
|
2932 | 2932 | \grammarterm{type-id} in a \keyword{dynamic_cast},
|
2933 |
| -\keyword{static_cast}, \tcode{reinterpret_cast}, or |
| 2933 | +\keyword{static_cast}, \keyword{reinterpret_cast}, or |
2934 | 2934 | \keyword{const_cast} can be the product of replacing a
|
2935 | 2935 | \tcode{>>} token by two consecutive \tcode{>}
|
2936 | 2936 | tokens\iref{temp.names}.
|
|
3957 | 3957 | lvalue-to-rvalue\iref{conv.lval}, array-to-pointer\iref{conv.array},
|
3958 | 3958 | and function-to-pointer\iref{conv.func} standard conversions are
|
3959 | 3959 | performed on the expression \tcode{v}. Conversions that can be performed explicitly
|
3960 |
| -using \tcode{reinterpret_cast} are listed below. No other conversion can |
3961 |
| -be performed explicitly using \tcode{reinterpret_cast}. |
| 3960 | +using \keyword{reinterpret_cast} are listed below. No other conversion can |
| 3961 | +be performed explicitly using \keyword{reinterpret_cast}. |
3962 | 3962 |
|
3963 | 3963 | \pnum
|
3964 |
| -The \tcode{reinterpret_cast} operator shall not cast away constness\iref{expr.const.cast}. |
| 3964 | +The \keyword{reinterpret_cast} operator shall not cast away constness\iref{expr.const.cast}. |
3965 | 3965 | An expression of integral, enumeration, pointer, or pointer-to-member type
|
3966 | 3966 | can be explicitly converted to its own type; such a cast yields the value of
|
3967 | 3967 | its operand.
|
3968 | 3968 |
|
3969 | 3969 | \pnum
|
3970 | 3970 | \begin{note}
|
3971 |
| -The mapping performed by \tcode{reinterpret_cast} might, or might not, produce a |
| 3971 | +The mapping performed by \keyword{reinterpret_cast} might, or might not, produce a |
3972 | 3972 | representation different from the original value.
|
3973 | 3973 | \end{note}
|
3974 | 3974 |
|
|
3987 | 3987 | type; the conversion has the same meaning and validity as a conversion of
|
3988 | 3988 | \tcode{(void*)0} to the integral type.
|
3989 | 3989 | \begin{note}
|
3990 |
| -A \tcode{reinterpret_cast} |
| 3990 | +A \keyword{reinterpret_cast} |
3991 | 3991 | cannot be used to convert a value of any type to the type
|
3992 | 3992 | \tcode{std::nullptr_t}.
|
3993 | 3993 | \end{note}
|
|
4035 | 4035 | The
|
4036 | 4036 | types can have different \cv-qualifiers, subject to
|
4037 | 4037 | the overall
|
4038 |
| -restriction that a \tcode{reinterpret_cast} cannot cast away constness. |
| 4038 | +restriction that a \keyword{reinterpret_cast} cannot cast away constness. |
4039 | 4039 | \end{footnote}
|
4040 | 4040 | When a prvalue \tcode{v} of object pointer type is converted to
|
4041 | 4041 | the object pointer type ``pointer to \cv{}~\tcode{T}'', the result is \tcode{static_cast<\cv{} T*>(static_cast<\cv{}~void*>(v))}.
|
|
4078 | 4078 | \begin{footnote}
|
4079 | 4079 | \tcode{T1} and \tcode{T2} can have
|
4080 | 4080 | different \cv-qualifiers, subject to
|
4081 |
| -the overall restriction that a \tcode{reinterpret_cast} cannot cast away |
| 4081 | +the overall restriction that a \keyword{reinterpret_cast} cannot cast away |
4082 | 4082 | constness.
|
4083 | 4083 | \end{footnote}
|
4084 | 4084 | The null member pointer value\iref{conv.mem} is converted to the
|
|
4106 | 4106 | can be cast to the type ``reference to \tcode{T2}''
|
4107 | 4107 | if an expression of type ``pointer to \tcode{T1}''
|
4108 | 4108 | can be explicitly converted to the type ``pointer to \tcode{T2}''
|
4109 |
| -using a \tcode{reinterpret_cast}. |
| 4109 | +using a \keyword{reinterpret_cast}. |
4110 | 4110 | The result is that of \tcode{*reinterpret_cast<T2 *>(p)}
|
4111 | 4111 | where \tcode{p} is a pointer to \placeholder{x}
|
4112 | 4112 | of type ``pointer to \tcode{T1}''.
|
|
5658 | 5658 | \pnum
|
5659 | 5659 | An explicit type conversion can be expressed using functional
|
5660 | 5660 | notation\iref{expr.type.conv}, a type conversion operator
|
5661 |
| -(\keyword{dynamic_cast}, \keyword{static_cast}, \tcode{reinterpret_cast}, |
| 5661 | +(\keyword{dynamic_cast}, \keyword{static_cast}, \keyword{reinterpret_cast}, |
5662 | 5662 | \keyword{const_cast}), or the \term{cast} notation.
|
5663 | 5663 |
|
5664 | 5664 | \begin{bnf}
|
|
5680 | 5680 | \item a \keyword{const_cast}\iref{expr.const.cast},
|
5681 | 5681 | \item a \keyword{static_cast}\iref{expr.static.cast},
|
5682 | 5682 | \item a \keyword{static_cast} followed by a \keyword{const_cast},
|
5683 |
| -\item a \tcode{reinterpret_cast}\iref{expr.reinterpret.cast}, or |
5684 |
| -\item a \tcode{reinterpret_cast} followed by a \keyword{const_cast}, |
| 5683 | +\item a \keyword{reinterpret_cast}\iref{expr.reinterpret.cast}, or |
| 5684 | +\item a \keyword{reinterpret_cast} followed by a \keyword{const_cast}, |
5685 | 5685 | \end{itemize}
|
5686 | 5686 | can be performed using the cast notation of explicit type conversion.
|
5687 | 5687 | The same semantic restrictions and behaviors apply, with the exception
|
|
5728 | 5728 | using the cast notation can be ``pointer to incomplete class type''. If
|
5729 | 5729 | both the operand and destination types are class types and one or both
|
5730 | 5730 | are incomplete, it is unspecified whether the \keyword{static_cast} or the
|
5731 |
| -\tcode{reinterpret_cast} interpretation is used, even if there is an |
| 5731 | +\keyword{reinterpret_cast} interpretation is used, even if there is an |
5732 | 5732 | inheritance relationship between the two classes.
|
5733 | 5733 | \begin{note}
|
5734 | 5734 | For example, if the classes were defined later in the translation unit,
|
|
7178 | 7178 | a conversion from type \cv{}~\tcode{void*} to a pointer-to-object type;
|
7179 | 7179 |
|
7180 | 7180 | \item
|
7181 |
| -a \tcode{reinterpret_cast}\iref{expr.reinterpret.cast}; |
| 7181 | +a \keyword{reinterpret_cast}\iref{expr.reinterpret.cast}; |
7182 | 7182 |
|
7183 | 7183 | \item
|
7184 | 7184 | a modification of an object~(\ref{expr.ass}, \ref{expr.post.incr},
|
|
0 commit comments