Quote:Original post by SymLinkedQuote:
When overriding a pointer as an integer, you'll need to be careful with 32/64 bit issues. Overriding a type as a type of different size can cause the binary writer to fail. In the case of hkpWorldObject, the alignment requirements of adjacent variables ensures that the object layout is still computed correctly for 64 bit machines.
Does it mean I'm safe?
If you have an integral type, X, such that sizeof(X) >= sizeof(SceneObject*), then the C++ standard guarantees that you can reinterpret_cast a SceneObject* to an X and back again without the final and original pointer values differing.
So if you use a static assertion to check the sizes, you can then reinterpret_cast to and fro safely. But pay attention to point 2 in NotAYakk's original post.
IMHO, it's best to avoid reinterpret_cast if you possibly can. But sometimes APIs force your hand.