Stuart Redmann wrote:
tu***********@gmail.com wrote:
>Hi all,
Why re-interpret cast should not be used in practise?
Where does it say so?
There are many cases where reinterpret_cast is the only chance to get
what you want. Your statement should better be re-phrased to:
If you have to use casts, try to use dynamic_cast, static_cast or
const_cast; reinterpret_cast should be your last resort.
reinterpret cast should be used as little as possible according to bjorn,
other ways to accomplish the same thing should be tried first. However,
that being said, there are times when reinterpret cast is the only way to do
something.
Why shouldn't reinterpret cast be used if it can be helped? It breaks type
safety. It is dangerous. It can work differently on different machines.
It can make code hard to read.
--
Jim Langston
ta*******@rocketmail.com