I've seen several assertions that C89 and C++03 define strict aliasing rules. I, however, cannot find that particular bit in the standard. My understanding was that strict aliasing rules were added in C99.
This text is present in C89, §3.3 EXPRESSIONS:
An object shall have its stored value accessed only by an lvalue that has one of the following types:
the declared type of the object,
a qualified version of the declared type of the object,
a type that is the signed or unsigned type corresponding to the
declared type of the object,a type that is the signed or unsigned type corresponding to a
qualified version of the declared type of the object,an aggregate or union type that includes one of the aforementioned
types among its members (including, recursively, a member of a
subaggregate or contained union), ora character type.
Violation of a "shall" constraint leads to undefined behaviour, so a set of allowed aliasing rules can be derived from this text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With