------- Comment #2 from paolo dot carlini at oracle dot com  2010-09-10 10:55 
_M_terminate_output, correctly, does nothing in this case, cannot be the
problem, and there is nothing wrong wrt the standard mandated behavior. The
"problem" is that in our implementation, similarly to traditional C stdio
impls, reading and writing are completely separate operations, and the user
switches between the two with seeks, essentially. Any seek puts back the
internal status to "uncommitted" (_M_reading = false, _M_writing = false) and
afterwards the user can start *either* reading or writing, irrespective of the
previous history, and the seek logic doesn't know what will actually happen in
the future, of course. The user should not perform redundant seeks, because
they have a cost, they do something more than just "seeking". On the other
hand, a series of read or write operations has maximum performance, we don't
think we could possibly do better. Thus, I'm open to ideas, but I don't think
that within the current design one can change / improve much. Note that the
patch you linked is exactly the one implementing the above semantics.



Reply via email to