This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: include strstream instead of strstream.h
On Sun, Aug 12, 2001 at 10:42:37AM +0200, Gabriel Dos Reis wrote:
> Benjamin Kosnik <bkoz@redhat.com> writes:
>
> | > -#include <strstream.h>
> | > +#include <strstream>
> |
> | ... both of these headers are deprecated, by <sstream>. If this really
> | bugs you for some reason, just set CXXFLAGS to use -Wno-deprecated in
> | your build tree.
>
> I think his point is that -we- are including that header in -our- own
> source code. See egcs/libstdc++-v3/src/strstream.cc:50.
>
> That is why I find his patch OK.
One more problem. The file libstdc++-v3/include/sstream includes
backward_warning.h. This causes a misleading warning to be
displayed, ie.
"Please use the <X> instead of the <X.h> header...."
I think the warning should be changed to something more
useful. How about something like:
Index: strstream
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/backward/strstream,v
retrieving revision 1.6
diff -u -r1.6 strstream
--- strstream 2001/06/27 17:09:52 1.6
+++ strstream 2001/08/12 15:32:33
@@ -48,7 +48,15 @@
#ifndef __SGI_STL_STRSTREAM
#define __SGI_STL_STRSTREAM
-#include "backward_warning.h"
+#ifdef __DEPRECATED
+#warning The <strstream> header is deprecated in section D.7.1 of the C++ standard. \
+ Please use the <sstream> header instead, and replace uses \
+ of classes in <strstream> with classes in <sstream> such as \
+ stringbuf, stringstream, istringstream, ostringstream, etc. \
+ To disable this warning use -Wno-deprecated.
+
+#endif
+
#include <bits/std_iosfwd.h>
#include <bits/std_ios.h>
#include <bits/std_istream.h>
--
Craig Rodrigues
http://www.gis.net/~craigr
rodrigc@mediaone.net