Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-12-08 07:29:57

On 07 Dec 2002 21:16:49 +0100, Gabriel Dos Reis
<gdr_at_[hidden]> wrote:

>Do you mean it is invalid to reinterpret_cast<> to void*?

Well, I'm not sure.

 5.2.10/7: "A pointer to an object can be explicitly converted to
 a pointer to an object of different type.65) Except that converting
 an rvalue of type "pointer to T1" to the type "pointer to T2" (where
 T1 and T2 are object types and where the alignment requirements of
 T2 are no stricter than those of T1) and back to its original type
 yields the original pointer value, the result of such a pointer
 conversion is unspecified.

If void* is not a "pointer to an object" then reinterpret_cast<void*>
is invalid. Otherwise it just yields an undefined result. I haven't
found a definition of "pointer to object" in the standard; anyhow
certainly void is not an object type.


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