I've searched through the standard about unaligned access, but didn't find anything (maybe I was inadvertent).
Is it undefined behavior? Is it implementation defined?
As a lot of current CPUs support unaligned access, it would be sensible that unaligned memory access is implementation defined. Is it the case?
By unaligned access, I mean for example:
alignas(int) char buffer[sizeof(int)+1];
int &x = *new(buffer+1) int;
x = 42;
sizeof(int)
and the required alignment are both implementation defined. Could be the same as forchar
. – Dzoba