Still struggling with C (C99) undefined and unspecified behaviours.
This time it is the following Unspecified Behaviour (Annex J.1):
The representation used when storing a value in an object that has more than one object representation for that value (6.2.6.1).
The corresponding section 6.2.6.1 states:
Where an operator is applied to a value that has more than one object representation, which object representation is used shall not affect the value of the result43). Where a value is stored in an object using a type that has more than one object representation for that value, it is unspecified which representation is used, but a trap representation shall not be generated.
with the following note 43:
It is possible for objects
x
andy
with the same effective typeT
to have the same value when they are accessed as objects of typeT
, but to have different values in other contexts. In particular, if==
is defined for typeT
, thenx == y
does not imply thatmemcmp(&x, &y, sizeof(T)) == 0
. Furthermore,x == y
does not necessarily imply thatx
andy
have the same value; other operations on values of typeT
may distinguish between them.
I don't even understand what would be a value that has more than one object representation. Is it related for example to a floating point representation of 0 (negative and positive zero) ?