[llvm-branch-commits] [libcxx] [libc++] Implements filebuf unbuffered. (PR #76629)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Feb 27 09:55:51 PST 2024
================
@@ -276,6 +276,30 @@ private:
state_type __st_;
state_type __st_last_;
ios_base::openmode __om_;
+ // Used to track the currently used mode and track whether the output should
+ // be unbuffered.
+ // [filebuf.virtuals]/12
+ // 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.
+ // This allows calling setbuf(0, 0)
+ // - before opening a file,
+ // - after opening a file, before
+ // - a read
+ // - a write
+ // - a seek.
+ // Note that opening a file with ios_base::ate does a seek operation.
+ // Normally underflow, overflow, and sync change this flag to
+ // ios_base::in, ios_base_out, or 0.
+ //
+ // The ios_base::trunc and ios_base::ate flags are used in the following way:
+ // - ios_base::trunc is set upon construction to indicate the unbuffered
----------------
ldionne wrote:
We should maybe introduce aptly-named values instead of reusing `trunc` and `ate`?
https://github.com/llvm/llvm-project/pull/76629
More information about the llvm-branch-commits
mailing list