From C++ standard:
Attempting to read or modify the stored value through any other type results in undefined behavior.
The first basic example illustrating this principle:
#include <cstdint>
std::uint32_t toInt(float value)
{
auto* p = reinterpret_cast<std::uint32_t*>(&value); // The cast itself is permitted.
return *p; // Undefined behavior: accesses a float object through a std::uint32_t glvalue.
}


