This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


1857. Additional questions about bits

Section: 7.6.7  [expr.shift]     Status: CD5     Submitter: Tony Van Eerd     Date: 2014-02-12

[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.

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.