Title
Rephrase ones' complement using base-2 representation
Status
c++23
Section
7.6.2.2 [expr.unary.op]
Submitter
Jim X

Created on 2022-09-10.00:00:00 last changed 16 months ago

Messages

Date: 2022-10-07.20:33:41

Proposed resolution (approved by CWG 2022-10-07):

Subclause 7.6.2.2 [expr.unary.op] paragraph 10 specifies:

The operand of ~ shall have integral or unscoped enumeration type; the result is the ones' complement of its operand. Integral promotions are performed. The type of the result is the type of the promoted operand. Given the coefficients xi of the base-2 representation (6.8.2 [basic.fundamental]) of the promoted operand x, the coefficient ri of the base-2 representation of the result r is 1 if xi is 0, and 0 otherwise. There is an ambiguity in the grammar...
Date: 2022-11-15.00:00:00

[Accepted as a DR at the November, 2022 meeting.]

Subclause 7.6.2.2 [expr.unary.op] paragraph 10 specifies:

The operand of ~ shall have integral or unscoped enumeration type; the result is the ones' complement of its operand. Integral promotions are performed. The type of the result is the type of the promoted operand. There is an ambiguity in the grammar...

This should be phrased in terms of the base-2 representation similar to bitwise-AND, instead of alluding to some bit representation by using the term "ones' complement".

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: drwp -> open
2023-02-18 18:43:04adminsetstatus: dr -> drwp
2022-11-25 05:14:04adminsetstatus: ready -> dr
2022-10-07 20:33:41adminsetstatus: open -> ready
2022-09-10 07:17:47adminsetmessages: + msg6933
2022-09-10 00:00:00admincreate