Re:Learning that you can use unions in C for grouping things...
by comex on Sunday August 01, 2021 @10:54PM
(#28032417)
Regardless, type punning though a union is not undefined behavior in C the first place [1] [2]. On the other hand, it is undefined in C++, but GCC allows it there too.
[1] https://stackoverflow.com/questions/11639947/is-type-punning...
[2] https://stackoverflow.com/questions/25664848/unions-and-type...