This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/12875] New: Weird behaviour in basic_filebuf::setbuf()
- From: "peturr02 at ru dot is" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Nov 2003 11:39:00 -0000
- Subject: [Bug libstdc++/12875] New: Weird behaviour in basic_filebuf::setbuf()
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12875
Summary: Weird behaviour in basic_filebuf::setbuf()
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The implementation defined behaviour of basic_filebuf::setbuf is
documented so:
(For filebuf and arguments for (p,s) other than zeros, libstdc++ does
what you'd expect: the first s bytes of p are used as a buffer, which
you must allocate and deallocate.)
The problem is that if some input or output has already been performed
on the file, setbuf() simply discards the contents of the old buffer
when switching to the new one.