sheafification8m agoHN ↗Yeah, but it’s got some caveats and is unsafe in some cases.https://en.cppreference.com/cpp/language/reinterpret_cast
jasode4m agoHN ↗reinterpret_cast<> for punning purposes can lead to UB. The recommended C++ alternative to avoid UB is bit_cast<>https://stackoverflow.com/questions/53401654/why-was-stdbit-...
Does reinterpret_cast works in c++ for this?
Yeah, but it’s got some caveats and is unsafe in some cases.
https://en.cppreference.com/cpp/language/reinterpret_cast
reinterpret_cast<> for punning purposes can lead to UB. The recommended C++ alternative to avoid UB is bit_cast<>
https://stackoverflow.com/questions/53401654/why-was-stdbit-...