lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Whether you agree of not does not really matter,static_cast is the
> correct cast to use and the result of reinterpret_cast is mostly
> implementation specific.

No, it's quite well-defined: "Converting a prvalue of type “pointer to
T1” to the type “pointer to T2” [...] and back to its original type
yields the original pointer value." The fact that the C++03 spec
doesn't make it clear that void* is allowed as T1 or T2 in this
context is in fact an error and the C++11 spec corrects this (see
defect 1120) -- and this is how every C++ compiler in common use does
it. So reinterpret_cast'ing to void* and back is guaranteed safe.

/s/ Adam