This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: libio/streambuf.h


Hi,
here's a patch for libio/streambuf.h. It contains some undefined C++ code by
trying to array delete a void pointer [5.3.5/3]. I found the problem because
I'm submitting a patch to egcs to warn on such source code. I believe the only
standard conforming way is to use `operator delete(e)' for this, both `delete
e' and `delete[] e' invoking undefined effects. The egcs discussion on this is
archived at http://egcs.cygnus.com/ml/egcs-bugs/1999-04/msg00345.html.

This patch is actually against the libio/streambuf.h in the egcs snapshot cvs
tree, but I just looked at the libstdc++ cvs version and it is the same.

Enjoy

nathan

libio/ChangeLog:
Thu Apr 15 11:56:59 BST 1999  Nathan Sidwell  <nathan@acm.org>

        * streambuf.h (ios::~ios): Use operator delete to remove _arrays.

-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
libio/ChangeLog:
Thu Apr 15 11:56:59 BST 1999  Nathan Sidwell  <nathan@acm.org>

	* streambuf.h (ios::~ios): Use operator delete to remove _arrays.

Index: egcs/libio/streambuf.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libio/streambuf.h,v
retrieving revision 1.5
diff -c -3 -p -r1.5 streambuf.h
*** streambuf.h	1998/02/24 20:09:55	1.5
--- streambuf.h	1999/04/15 10:45:14
*************** inline ios::~ios() {
*** 482,488 ****
  #ifndef _IO_NEW_STREAMS
      if (!(_flags & (unsigned int)ios::dont_close)) delete rdbuf();
  #endif
!     if (_arrays) delete [] _arrays;
  }
  } // extern "C++"
  #endif /* _STREAMBUF_H */
--- 482,488 ----
  #ifndef _IO_NEW_STREAMS
      if (!(_flags & (unsigned int)ios::dont_close)) delete rdbuf();
  #endif
!     operator delete (_arrays);
  }
  } // extern "C++"
  #endif /* _STREAMBUF_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]