N2479 C17..C2x working draft — February 5, 2020 ISO/IEC 9899:202x (E) (emphasis added):
6.7.2.1 Structure and union specifiers
17 Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared. A pointer to a structure object, suitably converted, points to its initial member (or if that member is a bit-field, then to the unit in which it resides), and vice versa. There may be unnamed padding within a structure object, but not at its beginning.
18 The size of a union is sufficient to contain the largest of its members. The value of at most one of the members can be stored in a union object at any time. A pointer to a union object, suitably converted, points to each of its members (or if a member is a bit-field, then to the unit in which it resides), and vice versa.
Question: what is the exact definition of suitably converted
?
Extra: if there is no exact definition of suitably converted
, then shall the C implementation document its understanding? For example (C/C++ preprocessor domain), Microsoft understands the term single item
(C++, N4713) as single, permanently indivisible preprocessor token
(which leads to issues while porting code from gcc/clang/other, which has different understanding), however, it seems that they don't document their understanding of the single item
.
Question: what is the exact definition of suitably converted?
The C standard does not give any “exact definition” of “suitably converted.”
I interpret it to mean any sequence of conversions to a type of “pointer to type of initial member” or “pointer to type of structure” such that the specifications of the conversions ensure the final pointer is pointing to the appropriate address. (E.g., has not passed through a conversion with possibly incorrect alignment.)
Extra: if there is no exact definition of suitably converted, then shall the C implementation document its understanding?
The C standard does not impose any requirement on a C implementation to document its understanding or interpretation of “suitably converted.”