Article View: comp.std.c++
Article #4078Re: IOSTREAM question : should ends manipulator flush buffer?
From: James Kanze US/ESC 60/3/141 #407...
Date: Wed, 17 Apr 1996 14:57
Date: Wed, 17 Apr 1996 14:57
41 lines
2526 bytes
2526 bytes
In article <sdm-1604961139410001@galois.ecs.soton.ac.uk>
S.D.Maclean@ecs.soton.ac.uk (Stuart Maclean) writes:
|> Hi, I'm currently implementing a stream class where the external
|> representation is a socket. Whilst playing with the following
|> TCPSocket tcp;
|> ....
|> Sockstream ss( tcp );
|> ss << "Hello World!" << endl;
|> ss << "Hello World!" << ends;
|> I noticed that manipulator "endl" synchronises with the external
|> representation, but "ends" does not. Tracing our IOStream library,
|> libg++-2.7.1, it indeed does not do a flush when using "ends". In C++PL2
|> by Stroustrup, page 348 has a comment implying that "ends" should do a
|> flush.
|> Does anyone know the correct behaviour for "ends" in the Standard C++
|> Library, whatever that is and whenever it may appear 8-)
The draft standard says nothing about a possible flush.
Given that ends means end of *string*, and the flush function is a
no-op in ostringstream, it's possible that the standards committee
simply felt that it wasn't necessary. (It's also possible that this is
an oversight in the draft.)
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<KANZE.96Apr17120619@slsvgqt.lts.sel.alcatel.de>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<sdm-1604961139410001@galois.ecs.soton.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) Newsgroups: comp.std.c++ Subject: Re: IOSTREAM question : should ends manipulator flush buffer? Date: 17 Apr 1996 14:57:41 GMT Organization: GABI Software, Sarl. Sender: news@lts.sel.alcatel.de Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <KANZE.96Apr17120619@slsvgqt.lts.sel.alcatel.de> References: <sdm-1604961139410001@galois.ecs.soton.ac.uk> NNTP-Posting-Host: taumet.eng.sun.com In-Reply-To: S.D.Maclean@ecs.soton.ac.uk's message of 16 Apr 96 12:27:03 GMT Apparently-To: std-c++@ncar.ucar.edu Content-Length: 1390 X-Lines: 34 Originator: clamage@taumet