Comment by codeflo
9 hours ago
> You can't load an integer from an unaligned address.
You can, and the results are machine specific, clearly defined and well-documented. Ancient ARM raises an exception, modern ARM and x86 can do it with a performance penalty. It's only the C or C++ layer that is allowed to translate the code into arbitrary garbage, not the CPU.
There’s usually not a performance penalty on modern hardware
There's typically only a performance penalty if the unaligned load spans a cache line on modern hardware.