Hi Christoph, Mainly because of portability reasons, we still need to pull into the global namespace things like istream, ostream, etc. However, we updated Riosfwd.h to only pull in the necessary class and NOT the entire std. This is available in CVS. Cheers, Philippe -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Christoph Borgmeier Sent: Thursday, August 29, 2002 6:56 AM To: Roottalk Subject: [ROOT] std namespace Hi all, I just ran into some trouble concerning the Root std namespace handling. The following program does not compile -------------------------------------------------------- #include <algorithm> #include <TObject.h> int max; int main() { max = 1; } -------------------------------------------------------- because of this error: -------------------------------------------------------- usingroot.C: In function `int main()': usingroot.C:8: use of `max' is ambiguous usingroot.C:4: first declared as `int max' here /usr/include/c++/3.2/bits/stl_algobase.h:207: also declared as `const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' here -------------------------------------------------------- Apparently any inclusion of a Root header file results in a using namespace std (in Riosfwd.h). This violates common C++ rules and is not necessary. The best fix would be to add std:: to the occurrences of istream, ostream, ifstream, ofstream in the Root header files. If there is still a supported compiler which does not tolerate that, could at least the `using namespace std;' in Riosfwd.h be changed into 'using std::istream;using std::ostream;...'? (Only half as bad.) Best regards Christoph
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:09 MET