2 ms·
Even in C, incompatible object accesses are undefined, not unspecified. (`char` is a major exception.) Using `union` is explicitly allowed by ISO C for this use
by lifthrasiir 3y ago
Even in C, incompatible object accesses are undefined, not unspecified. (`char` is a major exception.) Using `union` is explicitly allowed by ISO C for this use case; you need to use `memcpy` or `std::bit_cast` in C++ instead though.