Title
std::ios_base::iword/pword might be misspecified
Status
new
Section
[ios.base.storage]
Submitter
Jiang An

Created on 2022-02-14.00:00:00 last changed 26 months ago

Messages

Date: 2022-03-04.14:33:52

Proposed resolution:

This wording is relative to N4901.

  1. Modify [ios.base.storage] as indicated:

    long& iword(int idx);
    

    -3- […]

    -4- […]

    -5- Returns: On success iarray[idx]. On failure, an valid lvalue of type long& with value 0Linitialized to 0.

    void*& pword(int idx);
    

    -6- […]

    -7- […]

    -8- Returns: On success parray[idx]. On failure, an valid lvalue of type void*& with a null pointer valueinitialized to 0.

    -9- Remarks: After a subsequent call to pword(int) for the same object, the earlier return value may no longer be valid.

Date: 2022-03-15.00:00:00

[ 2022-03-04; Reflector poll ]

Set priority to 4 after reflector poll.

Date: 2022-02-14.00:00:00

Currently [ios.base.storage] p5 and p8 say "On failure, a valid long&/void*& initialized to 0". Such wording seems wrong, because a long&/void*& variable or return value can't be initialized with 0. And the values of referenced objects may be underspecified, because an implementation may reuse the same long/void* objects on failure, and thus it's insufficient to specify the initial values of these objects only.

History
Date User Action Args
2022-03-04 14:33:52adminsetmessages: + msg12398
2022-02-14 14:08:54adminsetmessages: + msg12376
2022-02-14 00:00:00admincreate