Boost logo

Boost :

From: Eric Woodruff (Eric.Woodruff_at_[hidden])
Date: 2002-10-09 11:06:19


How do you get the notion of it being undefined?

The standard says:
"7 A pointer to an object can be explicitly converted to a pointer to an
object of different type."

Then it seems to say that you cannot convert from T* to T2* then back to T*
and expect it to be defined--but we are not doing that.

"David Abrahams" <dave_at_[hidden]> wrote in message
news:uit0e1530.fsf_at_boost-consulting.com...
> 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] * http://www.boost-consulting.com
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk