Created on 1999-07-20.00:00:00 last changed 172 months ago
[ Post-Tokyo: Dietmar supplied wording at the request of the LWG. He comments: The rules can be made a little bit more specific if necessary be explicitly spelling out what virtuals are allowed to be called from what functions and eg to state specifically that flush() is allowed to call sync() while other functions are not. ]
[ Kona: the LWG believes this is a problem. Wish to ask Jerry or PJP why the standard is written this way. ]
Proposed resolution:
Change the last sentence of 27.6.2.1 (lib.ostream) paragraph 2 from:
They may use other public members of basic_ostream except that they do not invoke any virtual members of rdbuf() except overflow().
to:
They may use other public members of basic_ostream except that they shall not invoke any virtual members of rdbuf() except overflow(), xsputn(), and sync().
Paragraph 2 explicitly states that none of the basic_ostream functions falling into one of the groups "formatted output functions" and "unformatted output functions" calls any stream buffer function which might call a virtual function other than overflow(). Basically this is fine but this implies that sputn() (this function would call the virtual function xsputn()) is never called by any of the standard output functions. Is this really intended? At minimum it would be convenient to call xsputn() for strings... Also, the statement that overflow() is the only virtual member of basic_streambuf called is in conflict with the definition of flush() which calls rdbuf()->pubsync() and thereby the virtual function sync() (flush() is listed under "unformatted output functions").
In addition, I guess that the sentence starting with "They may use other public members of basic_ostream ..." probably was intended to start with "They may use other public members of basic_streamuf..." although the problem with the virtual members exists in both cases.
I see two obvious resolutions:
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg1729 |
2010-10-21 18:28:33 | admin | set | messages: + msg1728 |
2010-10-21 18:28:33 | admin | set | messages: + msg1727 |
1999-07-20 00:00:00 | admin | create |