This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: iostream buffer flushing and unitbuf
- From: "Ian S. Worthington" <ianworthington at usa dot net>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 01 Feb 2011 15:09:59 -0500
- Subject: Re: iostream buffer flushing and unitbuf
- Z-usanet-msgid: XID987PBauJ82272X39
Thanks Jonathon. That's making more sense now.
i
------ Original Message ------
Received: 07:31 PM COT, 01/31/2011
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Ian S. Worthington" <ianworthington@usa.net>Cc: libstdc++@gcc.gnu.org
Subject: Re: iostream buffer flushing and unitbuf
> On 31 January 2011 23:46, Ian S. Worthington wrote:
> > Hi --
> >
> > We're using the gnu iostream library under z/tpf.
> >
> > Multiline output messages to cout are being prefixed with a z/tpf header
in
> > such a way as to make us suspect that each \n is generating a flush.
> >
> > I have tried setting nounitbuf without effect.
> >
> > When I look through the iostream code I find a number of places which set
the
> > unitbuf flag but very few places which actually interrogate it.
> >
> > Could someone point me to where this flag is being used to control buffer
> > flushing?
>
> It's done by the sentry::~sentry destructor, defined in <ostream>
>
> But that should operate on units of "an output operation" which are
> not related to occurrences of \n
>
> e.g. this is a single output operation:
> std::cout << "foo\nbar\n";
>
> It sounds more like something affected by the fact the stdout stream
> is line-buffered when attached to a terminal, which would be
> controlled by something below the level of C++ iostreams.