You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If setbuf(0, 0) is called on a stream before any I/O has occurred on that stream, the stream becomes unbuffered. Otherwise the results are implementation-defined. "Unbuffered" means that pbase() and pptr() always return null and output to the file should appear as soon as possible.
We don't accept pubsetbuf() before a file has been opened. libstdc++ accepts pubsetbuf() only before a file has been opened. Opening the file should probably be considered I/O. Note that even if you move pubsetbuf() after the open we still don't do the right thing.
StephanTLavavej
changed the title
<fstream> basic_filebuf doesn't comply with setbuf(0,0) requirement in the standard
<fstream>: basic_filebuf doesn't comply with setbuf(0,0) requirement in the standard
Sep 21, 2020
[filebuf.virtuals]/12 says:
If
setbuf(0, 0)
is called on a stream before any I/O has occurred on that stream, the stream becomes unbuffered. Otherwise the results are implementation-defined. "Unbuffered" means thatpbase()
andpptr()
always return null and output to the file should appear as soon as possible.We don't accept
pubsetbuf()
before a file has been opened. libstdc++ acceptspubsetbuf()
only before a file has been opened. Opening the file should probably be considered I/O. Note that even if you movepubsetbuf()
after the open we still don't do the right thing.Test case
Based on libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/overflow.pass.cpp:
Expected behavior
The tests pass
STL version
Additional context
This must be an ABI breaking change as it forces us to remember whether that call happened somewhere.
Skipped libcxx test
STL/tests/libcxx/expected_results.txt
Lines 407 to 409 in faccf00
The text was updated successfully, but these errors were encountered: