reinterpret_cast, char*, and undefined behavior
What are the cases where reinterpret_cast ing a char* (or char[N] ) is undefined behavior, and when is it defined behavior? What is the rule of thumb I should be using to answer this question? As we learned from this question , the following is undefined behavior: alignas(int) char data[sizeof(int)]; int *myInt = new (data) int; // OK *myInt = 34; // OK int i = *reinterpret_cast<int*>(data); // <== UB! have to use std::launder But at what point can we do a reinterpret_cast on a char array and have it NOT be undefined behavior? Here are a few simple examples: No new , just reinterpret_cast :