This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug in endl (libio)
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Bug in endl (libio)
- From: jlquinn at us dot ibm dot com
- Date: Fri, 19 May 2000 17:41:02 -0400
In libio/iostream.cc, endl() should check if the stream can accept chars
before writing its eol. I found this because I was forcibly setting a
stream to eof in order to create a null stream that swallows chars (long
story - NT has a less than stellar iostream). In that situation, eols
still get written.
This is true in 2.95.2 as well as the latest cvs according to the web
pages.
Here's a patch:
--- /usr/project/gcc/iostream.cc.orig Fri May 19 17:37:57 2000
+++ /usr/project/gcc/iostream.cc Fri May 19 17:40:36 2000
@@ -963,7 +963,9 @@
ostream& endl(ostream& outs)
{
- return flush(outs.put('\n'));
+ if (opfx)
+ flush(outs.put('\n'));
+ return outs;
}
istream& lock(istream& ins)
Jerry Quinn
jlquinn@us.ibm.com