🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Stuart Maclean Tue, 16 Apr 1996 12:27
IOSTREAM question : should ends manipulator flush buffer?
#4057
Author: Stuart Maclean
Date: Tue, 16 Apr 1996 12:27
31 lines
1666 bytes
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                             ]
Re: IOSTREAM question : should ends manipulato
#4066
Author: Steve Clamage
Date: Tue, 16 Apr 1996 20:17
19 lines
1634 bytes
In article 1604961139410001@galois.ecs.soton.ac.uk, S.D.Maclean@ecs.soton.ac.uk (Stuart Maclean) writes:
>
>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". 

That is correct. It has always been the case (and is still the case
in the draft standard) that "ends" inserts a null character but does
not flush, and "endl" inserts a newline character followed by a flush.

---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Re: IOSTREAM question : should ends manipulator flush buffer?
#4078
Author: James Kanze US/ESC 60/3/141 #407...
Date: Wed, 17 Apr 1996 14:57
41 lines
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                             ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads