4 ms·
> The C standards, having to accommodate both target architectures where misaligned accesses worked and target architectures where these violently interrupted t
by zajio1am 3y ago
> The C standards, having to accommodate both target architectures where misaligned accesses worked and target architectures where these violently interrupted the program, applied their universal solution: they classified misaligned access as an undefined behavior.
No. If the C standard wants to accommodate different target architectures, they use implementation-specified behavior. The undefined behavior is just polite way to say that the code is buggy.
The C standard just requires natural alignment even on architectures that allows unaligned accesses.