Answer by Nicol Bolas for reinterpret_cast, char*, and undefined behavior
There are two rules at play here:[basic.lval]/8, aka, the strict aliasing rule: simply put, you can't access an object through a pointer/reference to the wrong type.[base.life]/8: simply put, if you...
View Articlereinterpret_cast, char*, and undefined behavior
What are the cases where reinterpret_casting 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...
View Article
More Pages to Explore .....