Chapter Contents |
Previous |
Next |
Pointer Qualification Conversions, Casts, and Run-Time Type Identification |
This release of the
C++ translator supports several new cast operators. These operators are defined
in the ISO C++ draft as improved alternatives to the old cast operators, for
example,
(type)(expr)
or
type_name (expr)
. For more information
on these operators, see Stroustrup's Design and Evolution of C++.
static_cast< type > ( expr )
const_cast< type > ( expr )
reinterpret_cast< type > ( expr )
dynamic_cast< type > ( expr )
The new cast operators, except
dynamic_cast
, provide
separate components of the functionality of the
old casts that allow improved type checking. Any old-style cast can be expressed
as a combination of the new casts. The new cast operators, other than
const_cast
, are not allowed to
cast away constness on pointer, pointer to member, and reference conversions.
See section 5.2.11 of the ISO draft for more information.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.