[gnu.g++.lib.bug] Does '\n' flush streams?

ham@Neon.Stanford.EDU (Peter R. Ham) (12/16/89)

I've asked this question before, but here goes again.
Should

cout << "\n" 

flush cout?

The libg++ test suite seems to imply that it should.  I'm not getting
that behavior on the pmax.  Maybe I should go debug the thing?

In Stroustrup's book, it says that and ostream should be flushed
in its destructor. The libg++ ~ostream doesn't seem to to this.
What am I missing?

--
Peter Ham			PO Box 3430	(h)(415) 322-4390
MS Computer Science Student	Stanford, CA	ham@cs.stanford.edu
Stanford University 		94309		(o)(415) 723-2067

rfg@ics.uci.edu (Ron Guilmette) (12/16/89)

In article <HAM.89Dec15104637@Neon.Stanford.EDU> ham@Neon.Stanford.EDU (Peter R. Ham) writes:
>I've asked this question before, but here goes again.
>Should
>
>cout << "\n" 
>
>flush cout?
>
>The libg++ test suite seems to imply that it should.  I'm not getting
>that behavior on the pmax.  Maybe I should go debug the thing?

Peter,

It doesn't.  The problem is that streams have not been `line buffered'
in the releases up to and including 1.36.1.

Doug Lea assures me however that libg++ 1.36.2 (when available) will do
line buffering (rather than block buffering) on streams.

>In Stroustrup's book, it says that and ostream should be flushed
>in its destructor. The libg++ ~ostream doesn't seem to to this.
>What am I missing?

Perhaps nothing.  I also noticed that stdout was not getting flushed
on program exit in libg++ 1.36.1 (and I reported it to Doug L.).
Sounds like your's could be a (very) related problem, so perhaps Doug
will have these both fixed in 1.36.2.

// rfg