Section: 220.127.116.11 [locale.codecvt.byname] Status: CD1 Submitter: Martin Sebor Opened: 2002-09-06 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [locale.codecvt.byname].
View all issues with CD1 status.
All but one codecvt member functions that take a state_type argument list as one of their preconditions that the state_type argument have a valid value. However, according to 18.104.22.168.2, p6, codecvt::do_unshift() is the only codecvt member that is supposed to return error if the state_type object is invalid.
It seems to me that the treatment of state_type by all codecvt member functions should be the same and the current requirements should be changed. Since the detection of invalid state_type values may be difficult in general or computationally expensive in some specific cases, I propose the following:
Add a new paragraph before 22.214.171.124.2, p5, and after the function declaration below
result do_unshift(stateT& state, externT* to, externT* to_limit, externT*& to_next) const;
Requires: (to <= to_end) well defined and true; state initialized, if at the beginning of a sequence, or else equal to the result of converting the preceding characters in the sequence.
and change the text in Table 54, row 4, the error row, under the heading Meaning, from
state has invalid value
an unspecified error has occurred
The intent is that implementations should not be required to detect invalid state values; such a requirement appears nowhere else. An invalid state value is a precondition violation, i.e. undefined behavior. Implementations that do choose to detect invalid state values, or that choose to detect any other kind of error, may return error as an indication.