C99 strict aliasing rules in C++ (GCC)
- by Checkers
As far as I understand, GCC supports all of its C99 features in C++. But how is C99 strict aliasing handled in C++ code?
I know that casting with C casts between unrelated types is not strict-aliasing-safe and may generate incorrect code, but what about C++? Since strict aliasing is not part of C++ standard (is that correct?), GCC must be specifying the semantics itself.
I figure const_cast and static_cast cast between related types, hence they are safe, while reinterpret_cast can break strict aliasing rules.
Is this a correct understanding?