Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-07 13:22:59

Daniel Frey <daniel.frey_at_[hidden]> writes:

> David Abrahams wrote:
> >
> > Well, I don't know about your problem domain, but AFAICT, there's
> > never an excuse for reinterpret_cast<>. Its effects are
> > implementation-defined, whereas the behavior of static_cast<> is
> > always defined. As for creating temporary objects, if you're
> > static_cast-ing pointers, it can only create temporary pointers. I'm
> > sure that's not a problem for you, is it?
> My experiments with static_cast for the given problem ended in an
> infinite loop if I used it directly. And if going through a void*, this
> is no safer than a reinterpret_cast

Why do you say that? reinterpret_cast has completely
implementation-dependent behavior. You can't know what it will do
without reading the manual for each compiler you're
targeting. static_cast has behavior that's specified by the standard.

           David Abrahams * Boost Consulting
dave_at_[hidden] *

Boost list run by bdawes at, gregod at, cpdaniel at, john at