Title
Parsing functions should save and restore stream format state
Status
nad
Section
[time.parse]
Submitter
Howard Hinnant

Created on 2019-09-02.00:00:00 last changed 58 months ago

Messages

Date: 2020-02-24.16:10:06

Proposed resolution:

This wording is relative to N4830.

[Drafting note: The modification of [time.parse] p1 is intended to be non-conflictingly mergeable with the change suggested by LWG 3269 at the same paragraph.]

  1. Modify [time.parse] as indicated:

    -1- Each parse overload specified in this subclause calls from_stream unqualified, so as to enable argument dependent lookup ([basic.lookup.argdep]). In the following paragraphs, let is denote an object of type basic_istream<charT, traits>, where charT and traits are template parameters in that context.

    […]

    -10- All from_stream overloads behave as unformatted input functions, except that they have an unspecified effect on the value returned by subsequent calls to basic_istream<>::gcount(). Any changes made to is.fill(), is.width() or is.flags() are undone prior to an returning or exceptional execution ([thread.once.callonce]). Each overload takes a format string containing ordinary characters and flags which have special meaning. Each flag begins with a %. Some flags can be modified by E or O. During parsing each flag interprets characters as parts of date and time types according to Table [tab:time.parse.spec]. Some flags can be modified by a width parameter given as a positive decimal integer called out as N below which governs how many characters are parsed from the stream in interpreting the flag. All characters in the format string that are not represented in Table [tab:time.parse.spec], except for white space, are parsed unchanged from the stream. A white space character matches zero or more white space characters in the input stream.

Date: 2020-02-24.16:10:06
LWG reviewed the issue and decided no change is needed. Unless specified to change the flags, it's assumed that the stream flags are unchanged by any input function.

[ 2020-02, Prague; Close as NAD ]

LWG reviewed the issue and decided no change is needed. Unless specified to change the flags, it's assumed that the stream flags are unchanged by any input function.
Date: 2019-10-07.02:21:30

[ 2019-10 Priority set to 3 after reflector discussion ]

Date: 2019-09-02.00:00:00

from_stream overloads may need to set various formatting state and flags of the basic_istream to implement the parsing functionality. Such settings must not persist beyond the parsing functions. Thus these functions need to save and restore any settings on the basic_istream they may need to change.

History
Date User Action Args
2020-02-24 16:10:06adminsetmessages: + msg11148
2020-02-24 16:10:06adminsetstatus: new -> nad
2019-10-07 02:21:30adminsetmessages: + msg10678
2019-09-14 10:50:06adminsetmessages: + msg10603
2019-09-02 00:00:00admincreate