Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-09 11:21:28

"Eric Woodruff" <Eric.Woodruff_at_[hidden]> writes:

> How do you get the notion of it being undefined?

I never said anything was undefined. I said the behavior of
reinterpret_cast was implementation-defined.

> 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.

You can't count on any particular behavior if you use reinterpret_cast
for anything, unless you read the compiler manual first.

Wow, this seems really difficult to grasp, but I can't understand why.

    5.2.10 Reinterpret cast
    3 The mapping performed by reinterpret_cast is
    implementation-defined. [Note: it might, or might not, produce a
    representation different from the original value. ]

That means it does _something_, but only the compiler vendor and those
who have read the manual know what it does.

           David Abrahams * Boost Consulting
dave_at_[hidden] *

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