Section: 220.127.116.11 [ios.base.storage] Status: C++20 Submitter: Jonathan Wakely Opened: 2018-03-16 Last modified: 2021-02-25 10:48:01 UTC
View all other issues in [ios.base.storage].
View all issues with C++20 status.
Is calling iword and pword with a negative argument undefined, or should it cause a failure condition (and return a valid reference)? What about INT_MAX? What about 0?Using arbitrary indices isn't safe, because the implementation could be already using them for something else. Some replies on the reflector suggested the only reliable argument is one obtained from ios_base::xalloc(). Others pointed out that the iwords and pwords could be stored in sparse arrays, so that any value from INT_MIN to INT_MAX could be a valid key (which might require the implementation to use keys outside that range for its own entries in the arrays). If it's undefined we should add a Requires element to the spec. If invalid indices are supposed to cause a failure we need to define which indices are invalid (and ensure that's something the implementation can check), and specify that it causes a failure.
[ 2018-03-27 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
[2018-06 Rapperswil: Adopted]
This wording is relative to N4727.
Edit 18.104.22.168 [ios.base.storage] as indicated:
long& iword(int idx);
-3- Effects: If iarray is a null pointer, […] […]void*& pword(int idx);
-5- Effects: If iarray is a null pointer, […] […]