[Bug libstdc++/12875] New: Weird behaviour in basic_filebuf::setbuf()

peturr02 at ru dot is gcc-bugzilla@gcc.gnu.org
Sun Nov 2 11:39:00 GMT 2003


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.



More information about the Gcc-bugs mailing list