Additional questions about bits
7.6.7 [expr.shift]
Tony Van Eerd

Created on 2014-02-12.00:00:00 last changed 18 months ago


Date: 2014-06-15.00:00:00

Notes from the June, 2014 meeting:

CWG decided to reformulate the description of the operations themselves to avoid references to bits, splitting off the larger questions of defining “bit” and the like to issue 1943 for further consideration.

Date: 2018-11-15.00:00:00

[Adopted at the November, 2018 meeting as part of paper P1236R1.]

The resolution of issue 1796 addressed only the relationship of “bits” with the null character value. The values and arrangements of bits within an object are also mentioned in other contexts; these should also be considered for revision. For example, 7.6.7 [expr.shift] paragraph 2 says,

The value of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are zero-filled.

This appears to place constraints on the bit representation, which (as noted in issue 1796) is not accessible to the program. A similar statement appears in paragraph 3 for >>.

The specification of the bitwise operations in 7.6.11 [expr.bit.and], 7.6.12 [expr.xor], and 7.6.13 [expr.or] uses the undefined term “bitwise” in describing the operations, without specifying whether it is the value or object representation that is in view.

Part of the resolution of this might be to define “bit” (which is otherwise currently undefined in C++) as a value of a given power of 2.

Date User Action Args
2021-02-17 00:00:00adminsetstatus: drafting -> cd5
2014-07-07 00:00:00adminsetmessages: + msg5087
2014-07-07 00:00:00adminsetstatus: open -> drafting
2014-02-12 00:00:00admincreate