4 ms·
Unless you try hard to provoke one, there is no unaligned access. Adding a pointer and an integer in C always displaces the pointer by elements, not by bytes. S
by tom_mellior 7y ago
Unless you try hard to provoke one, there is no unaligned access. Adding a pointer and an integer in C always displaces the pointer by elements, not by bytes. So if p is a pointer to some type T and is aligned, then p + 1 will be aligned as well.
You need to cast to another pointer type, do arithmetic on that, then cast back to produce an unaligned access.