char foo[n] = /*init here*/; // n = 4*k + 4.
int i = 0;
while (i < n) {
int four_bytes = *reinterpret_cast<const int*>(foo + i); // is this UB?
bar(four_bytes);
i += 4;
}
In this snippet of code (assuming all data is initted properly, and that the array's length is a multiple of 4), is this reinterpret_cast
UB?
C++14 and someetimes C++11