I'm trying to find this in C++ standard (ISO/IEC 14882) but unfortunately I can't.
Is this standard conforming? Will it result in undefined behaviour? I am SURE that Get() will return pointer to UserClass not to something else.Code:// external functions (in DLL if this matters at all) extern "C" int Set(void* Ptr); extern "C" int Get(void** Ptr); // ... UserClass* a; Set(a); // ... UserClass* ptr; Get(reinterpret_cast<void**>(&ptr));
I have my doubts because there is a hidden conversion from UserClass* to void* (I know I can solve this using a temporary variable).