This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

113. Missing/extra iostream sync semantics

Section: 31.7.5.2 [istream], 31.7.5.4 [istream.unformatted] Status: NAD Submitter: Steve Clamage Opened: 1998-10-13 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [istream].

View all issues with NAD status.

Discussion:

In 27.6.1.1, class basic_istream has a member function sync, described in 27.6.1.3, paragraph 36.

Following the chain of definitions, I find that the various sync functions have defined semantics for output streams, but no semantics for input streams. On the other hand, basic_ostream has no sync function.

The sync function should at minimum be added to basic_ostream, for internal consistency.

A larger question is whether sync should have assigned semantics for input streams.

Classic iostreams said streambuf::sync flushes pending output and attempts to return unread input characters to the source. It is a protected member function. The filebuf version (which is public) has that behavior (it backs up the read pointer). Class strstreambuf does not override streambuf::sync, and so sync can't be called on a strstream.

If we can add corresponding semantics to the various sync functions, we should. If not, we should remove sync from basic_istream.

Rationale:

A sync function is not needed in basic_ostream because the flush function provides the desired functionality.

As for the other points, the LWG finds the standard correct as written.