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:06 MET