Topic: Cast
Author: Arthur Rabatin <research@rabatin.com>
Date: 1998/06/02 Raw View
dynamic_cast
static_cast
const_cast
For C++. The advantage is that the result values are defined and casts are
easily to read in the code. "Brute Force" casting APointer* pAObject =
(APointer*) (pBObject) still works, but is not type safe; above are (as much
as it can get). Avoid const_cast as much as possible.
Best check your compiler manual for behaviour
Arthur
.................................
Rabatin Investment Technology Ltd
http://www.rabatin.com
research@rabatin.com
Matthias Rumplmaier wrote:
> What are the ANSI/ISO possibilities to cast?
> How do they work?
> Can you give me an example?
>
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: bzinger@endeavor.flash.net (Michael A. Benzinger)
Date: 1998/06/03 Raw View
Don't forget reinterpret_cast.
Regards,
Mike Benzinger
On 2 Jun 1998 14:14:59 GMT, Arthur Rabatin <research@rabatin.com>
wrote:
>
>dynamic_cast
>static_cast
>const_cast
>
>For C++. The advantage is that the result values are defined and casts are
>easily to read in the code. "Brute Force" casting APointer* pAObject =
>(APointer*) (pBObject) still works, but is not type safe; above are (as much
>as it can get). Avoid const_cast as much as possible.
>
>Best check your compiler manual for behaviour
>
>Matthias Rumplmaier wrote:
>
>> What are the ANSI/ISO possibilities to cast?
>> How do they work?
>> Can you give me an example?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]