Created on 1998-06-21.00:00:00 last changed 171 months ago
[ post-Copenhagen: proposed resolution was revised slightly: text was added in the non-normative footnote to say that operations on the two streams can be mixed arbitrarily. ]
[ pre-Copenhagen: PJP and Matt contributed the definition of "synchronization" ]
Proposed resolution:
Change the following sentence in [ios.members.static] returns clause from:
true if the standard iostream objects (27.3) are synchronized and otherwise returns false.
to:
true if the previous state of the standard iostream objects (27.3) was synchronized and otherwise returns false.
Add the following immediately after [ios.members.static], paragraph 2:
When a standard iostream object str is synchronized with a standard stdio stream f, the effect of inserting a character c by
fputc(f, c);is the same as the effect of
str.rdbuf()->sputc(c);for any sequence of characters; the effect of extracting a character c by
c = fgetc(f);is the same as the effect of:
c = str.rdbuf()->sbumpc(c);for any sequences of characters; and the effect of pushing back a character c by
ungetc(c, f);is the same as the effect of
str.rdbuf()->sputbackc(c);for any sequence of characters. [Footnote: This implies that operations on a standard iostream object can be mixed arbitrarily with operations on the corresponding stdio stream. In practical terms, synchronization usually means that a standard iostream object and a standard stdio object share a buffer. --End Footnote]
Two problems
(1) 27.4.2.4 doesn't say what ios_base::sync_with_stdio(f) returns. Does it return f, or does it return the previous synchronization state? My guess is the latter, but the standard doesn't say so.
(2) 27.4.2.4 doesn't say what it means for streams to be synchronized with stdio. Again, of course, I can make some guesses. (And I'm unhappy about the performance implications of those guesses, but that's another matter.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg113 |
2010-10-21 18:28:33 | admin | set | messages: + msg112 |
2010-10-21 18:28:33 | admin | set | messages: + msg111 |
1998-06-21 00:00:00 | admin | create |