Created on 2022-01-20.00:00:00 last changed 12 months ago
Proposed resolution (approved for C++26 by CWG 2023-02-06):
Change in 6.8.1 [basic.types.general] paragraph 4 as follows:
The object representation ofan object ofa complete object type T is the sequence of N unsigned char objects taken up bythea non-bit-field complete object of type T, where N equals sizeof(T). The value representation ofan object ofa type T is the set of bits in the object representation of T that participate in representing a value of type T. The object and value representation of a non-bit-field complete object of type T are the bytes and bits, respectively, of the object corresponding to the object and value representation of its type. The object representation of a bit-field object is the sequence of N bits taken up by the object, where N is the width of the bit-field (11.4.10 [class.bit]). The value representation of a bit-field object is the set of bits in the object representation that participate in representing its value. Bits in the object representation of a type or object that are not part of the value representation are padding bits. For trivially copyable types, the value representation is a set of bits in the object representation that determines a value, which is one discrete element of an implementation-defined set of values. [ Footnote: ... ]
CWG 2023-02-06
Additional drafting is needed to constrain the definition to complete object types.
Proposed resolution (approved by CWG 2023-01-06) [SUPERSEDED]:
Change in 6.8.1 [basic.types.general] paragraph 4 as follows:
The object representation ofan object ofa type T is the sequence of N unsigned char objects taken up bythea non-bit-field complete object of type T, where N equals sizeof(T). The value representation ofan object ofa type T is the set of bits in the object representation of T that participate in representing a value of type T. The object and value representation of a non-bit-field complete object of type T are the bytes and bits, respectively, of the object corresponding to the object and value representation of its type. The object representation of a bit-field object is the sequence of N bits taken up by the object, where N is the width of the bit-field (11.4.10 [class.bit]). The value representation of a bit-field object is the set of bits in the object representation that participate in representing its value. Bits in the object representation of a type or object that are not part of the value representation are padding bits. For trivially copyable types, the value representation is a set of bits in the object representation that determines a value, which is one discrete element of an implementation-defined set of values. [ Footnote: ... ]
[Accepted as a DR at the June, 2023 meeting.]
6.7.2 [intro.object] clearly implies that bit-fields are objects; paragraphs 8-9 contain phrases like “unless an object is a bit-field...” and “a non-bit-field subobject”. However, the definition of “object representation” in 6.8.1 [basic.types.general] paragraph 4 is,
The object representation of an object of type T is the sequence of N unsigned char objects taken up by the object of type T, where N equals sizeof(T).
and thus fails to address bit-fields, which are not necessarily composed of a sequence of complete bytes.
The C Standard (6.2.6.1 paragraph 4) says,
Values stored in bit-fields consist of m bits, where m is the size specified for the bit-field. The object representation is the set of m bits the bit-field comprises in the addressable storage unit holding it.
Presumably similar wording could be adopted for C++.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-12-19 10:15:28 | admin | set | status: dr -> drwp |
2023-07-16 13:00:43 | admin | set | status: ready -> dr |
2023-06-13 16:05:19 | admin | set | status: tentatively ready -> ready |
2023-02-07 14:43:26 | admin | set | messages: + msg7165 |
2023-02-07 14:43:26 | admin | set | messages: + msg7164 |
2023-01-07 14:23:21 | admin | set | messages: + msg7118 |
2023-01-07 14:23:21 | admin | set | status: drafting -> tentatively ready |
2022-11-20 07:54:16 | admin | set | status: open -> drafting |
2022-01-20 00:00:00 | admin | create |