3 ms·
union wasn't designed for the type punning in the first place. It's just historically used for type punning. For modern compiler, just use memcpy and compiler
by ezoe 8y ago
union wasn't designed for the type punning in the first place. It's just historically used for type punning.
For modern compiler, just use memcpy and compiler can optimize away the memcpy and produce the exactly same code.
But the kernel developers has some issues on trusting compiler generated code.