Hi Alessandro, On Fri, 2004-10-15 at 10:16 +0200, Alessandro Thea wrote: > Hi, > after reading your mail I tried to add the following lines to the header > of my class: > > #ifndef __MAKECINT__ > typedef ostringstream ostrstream; > typedef stringstreambase strstreambase; > #endif /*__MAKECINT__*/ > > the #ifndef is needed to hide stringstreambase to rootcint because it > seems not to know that class. > It works well with gcc 2.96 but it doesn't with 3.32... > Does exist a way to let the preprocessor know which is the current > compiler version? Yep. #ifndef __GNUC__ || __GNUC__ < 3 # ifndef __MAKECINT__ typedef ostringstream ostrstream; typedef stringstreambase strstreambase; # endif /*__MAKECINT__*/ #endif To see what kind of macros are defined, do something like > echo "int main() { return 0; }" > foo.cc > g++ -v foo.cc BTW, there's no such thing as GCC 2.96! It's purely a Red Hat `release' of GCC. I'd suggest you upgrade your machine to Red Hat 8+ and/or the compiler to GCC 3.3+ (Skip 3.0, 3.1, and 3.2, as they all have problems). stringstreambase is implementation specific to GCC, and you should not use it. The ISO/IEC C++ standard defines the class template basic_stringstream, which is the closest thing you'll get to a base class for the stringstream classes. However, basic_stringstream<C,T,A> does inherit from basic_iostream<C,T,A>. This in turn inherits from basic_ios<C,T> via basic_istream<C,T>, and ultimately they inherit from ios_base. > >My question is: there is a way to understand why or where rootcint decide to > >use ostrstream instead of ostringstream? To me, it seems like a shortcomming of CINT to use `ostrstream' instead of `ostringstream' especially since the former is not part of the ISO/IEC C++ standard. Yours, -- ___ | Christian Holm Christensen |_| | ------------------------------------------------------------- | | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 _| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91 _| Denmark Office: (+45) 353 25 404 ____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm | |
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET