Date: Tue, 30 Apr 2024 19:10:50 +0300
> Jens Maurer wrote:
> > > It's a bit vague but std::cout is
> > > https://eel.is/c++draft/narrow.stream.objects#3
> > >
> > > "The object cout controls output to a stream buffer associated with
> > > the object stdout, declared in <cstdio>."
> > >
> > > which strongly implies a `filebuf` that writes to `stdout`, even
> > > though it's not required to be literally that and can be e.g. of
> > > type
> > __stdout_streambuf.
> >
> > A "filebuf" is not a std::fstream, and a "stream buffer" certainly is
> > not necessarily a streambuf for a file.
>
> Not necessarily, but `stdout` is a FILE*. So it's not an unreasonable
> assumption.
>
> > Where do we say this part in the standard, outside of the std::fstream
> > specification?
> >
> > "the streambuf uses codecvt::out to transcode"
>
> Nowhere. But isn't it a de-facto standard at this point?
Oh, I see. libstdc++ ignores the locale in stdio_sync_filebuf.
But this doesn't present a problem for us, because char -> char is still
a no-op.
> > > It's a bit vague but std::cout is
> > > https://eel.is/c++draft/narrow.stream.objects#3
> > >
> > > "The object cout controls output to a stream buffer associated with
> > > the object stdout, declared in <cstdio>."
> > >
> > > which strongly implies a `filebuf` that writes to `stdout`, even
> > > though it's not required to be literally that and can be e.g. of
> > > type
> > __stdout_streambuf.
> >
> > A "filebuf" is not a std::fstream, and a "stream buffer" certainly is
> > not necessarily a streambuf for a file.
>
> Not necessarily, but `stdout` is a FILE*. So it's not an unreasonable
> assumption.
>
> > Where do we say this part in the standard, outside of the std::fstream
> > specification?
> >
> > "the streambuf uses codecvt::out to transcode"
>
> Nowhere. But isn't it a de-facto standard at this point?
Oh, I see. libstdc++ ignores the locale in stdio_sync_filebuf.
But this doesn't present a problem for us, because char -> char is still
a no-op.
Received on 2024-04-30 16:10:56