[Patch] Two other thingies
Benjamin Kosnik
bkoz@redhat.com
Wed May 7 05:03:00 GMT 2003
The other part of this is fine Paolo.
>I believe filebuf::close() must set pptr() and gptr() to NULL, as sgetc
>and sputc should always return EOF when is_open() == false.
I think you are referring to
27.8.1.1 - Template class basic_filebuf p3
where
* If the file is not open for reading the input sequence cannot be read.
* If the file is not open for writing the output sequence cannot be written.
the real issue is streambuf::xsgetn/xsputn, which might not be safe for
this without the explicit setting you are attempting to remove.
As you imply, there should be tests of sgetn on an ostream, sputn on an
istream, etc. before you attempt simplification. There might be some
tests like this existent in the testsuite, but probably nothing
consistent? Testing this should be possible if you test with a derived
class of filebuf, but you might as well do the whole enchilada and do
all the streambufs, with all the members.
ie:
ostream with
int_type snextc();
int_type sbumpc();
int_type sgetc();
streamsize sgetn(char_type* s, streamsize n);
istream with:
int_type sputc(char_type c);
streamsize sputn(const char_type* s, streamsize n);
-benjamin
More information about the Libstdc++
mailing list