libstdc++/3593: Overloading streambuf for ostream doesn't appear to work

Stephen M. Webb
Mon Jul 9 10:34:00 GMT 2001

The sample program in this bug report made assumptions about the
representational value of underlying constants.  The streambuf::overflow()
member function must return traits_type::eof() to failure, and the arbitrary
value returned in the example just happens to map to traits_type::eof().

When the return value of the streambuf::overflow() member function is changed
from "return 0;" to "return traits_type::not_eof(c);", the sample program works
as expected.

This is not a bug in the application code and not in the library.  The PR
should be closed.

Stephen M. Webb

More information about the Gcc-bugs mailing list