Topic: IOSTREAM question : should ends manipulator flush buffer?
Author: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Date: 1996/04/17 Raw View
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 ]
Author: S.D.Maclean@ecs.soton.ac.uk (Stuart Maclean)
Date: 1996/04/16 Raw View
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-)
Any help gratefully appreciated.
Stuart
--
Stuart
---
[ 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 ]