Should C89 or C ++ 03 define strict alias rules?

I have seen several claims that C89 and C ++ 03 define strict alias rules. However, I cannot find this particular bit in the standard. I realized that strict alias rules were added on the C99.

+5
source share
3 answers

The C ++ 03 standard has a value <<20>:

If the program tries to access the stored value of the object through a value l other than one of the following types, the behavior is undefined 48) :
- the dynamic type of the object,
- the cv-qualified version of the dynamic type of the object,
- a type that is a signed or unsigned type corresponding to dynamic object type,
- a type that is a signed or unsigned type corresponding to the standard version of the dynamic object type cv,
- a collection or union type that includes one of the above types pov among its members (including, recursively, a member of a sub-aggregate or contained association),
- a type that is (possibly cv-qualified) the base class type of the dynamic type of the object,
- a char or unsigned char type.

Footnote:

48) The purpose of this list is to indicate the circumstances under which the object may or may not be smoothed.

This site also contains sections in other standards.

+5
source

This text is present in C89, §3.3. EXPRESSIONS:

The object must store a value that is accessible only by the value of l, which has one of the following types:

  • declared type of object

  • qualified version of the declared object type,

  • a type that is a signed or unsigned type, the corresponding declared type of an object,

  • , , ,

  • , ( , , subaggregate contains union),

  • .

"" undefined, .

+5

3.3 C89, 3.10/15 ++ 03.

, ", - , ".

+5

All Articles