Title
Missing/extra iostream sync semantics
Status
nad
Section
[istream] [istream.unformatted]
Submitter
Steve Clamage

Created on 1998-10-13.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

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.

Date: 1998-10-13.00:00:00

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.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg849
1998-10-13 00:00:00admincreate