Title
Pointer arithmetic with pointer to hypothetical element
Status
dr
Section
7.6.6 [expr.add]
Submitter
Jim X

Created on 2024-02-03.00:00:00 last changed 3 weeks ago

Messages

Date: 2024-02-16.23:23:05

Proposed resolution (approved by CWG 2024-02-16):

Change in 7.6.6 [expr.add] bullet 4.2 as follows:

  • ...
  • Otherwise, if P points to an a (possibly-hypothetical) array element i of an array object x with n elements (9.3.4.5 [dcl.array]), [ Footnote: ... ] the expressions P + J and J + P (where J has the value j) point to the (possibly-hypothetical) array element i + j of x if 0 <= i + j <= n and the expression P - J points to the (possibly-hypothetical) array element i - j of x if 0 <= i - j <= n.
Date: 2024-03-15.00:00:00

[Accepted as a DR at the March, 2024 meeting.]

(From submission #495.)

The phrasing in 7.6.6 [expr.add] bullet 4.2 excludes pointer arithmetic on a pointer pointing to the hypothetical (past-the-end) array element.

History
Date User Action Args
2024-04-05 21:43:46adminsetstatus: ready -> dr
2024-03-20 14:10:31adminsetstatus: tentatively ready -> ready
2024-02-16 23:23:05adminsetmessages: + msg7607
2024-02-16 23:23:05adminsetstatus: open -> tentatively ready
2024-02-03 00:00:00admincreate