
The recent min max changes have caused breakages with vc7.1 + STLPort, the problem is that this configuration defines BOOST_NO_STDC_NAMESPACE (because STLPort doesn't quite manage to import everything into it's "fake" std namespace), which causes the following code: template< typename T > inline T const & std_max( T const & a, T const & b ) { #if defined(__COMO__) || defined(BOOST_INTEL) || defined(BOOST_NO_STD_MIN_MAX) using std::max; #elif defined(BOOST_NO_STDC_NAMESPACE) using ::max; // <- error here #else using std::max; #endif return max BOOST_PREVENT_MACRO_SUBSTITUTION ( a, b ); } to fail, because min and max *are* in namespace std. Now the thing is, BOOST_NO_STDC_NAMESPACE was only really designed to check for C lib functions, it was assumed that std lib functions like min and max are always in namespace std, are there any situations where that is not the case? If not we can just ditch the #elif defined(BOOST_NO_STDC_NAMESPACE) clause altogether. John.

John Maddock wrote:
The recent min max changes have caused breakages with vc7.1 + STLPort, the problem is that this configuration defines BOOST_NO_STDC_NAMESPACE (because STLPort doesn't quite manage to import everything into it's "fake" std namespace), which causes the following code:
template< typename T > inline T const & std_max( T const & a, T const & b ) { #if defined(__COMO__) || defined(BOOST_INTEL) || defined(BOOST_NO_STD_MIN_MAX) using std::max; #elif defined(BOOST_NO_STDC_NAMESPACE) using ::max; // <- error here #else using std::max; #endif return max BOOST_PREVENT_MACRO_SUBSTITUTION ( a, b ); }
to fail, because min and max *are* in namespace std. Now the thing is, BOOST_NO_STDC_NAMESPACE was only really designed to check for C lib functions, it was assumed that std lib functions like min and max are always in namespace std, are there any situations where that is not the case? If not we can just ditch the #elif defined(BOOST_NO_STDC_NAMESPACE) clause altogether.
Thanks for catching this John. I borrowed this preprocessor logic from the Interval library. In an earlier discussion, Guillaume suggested I use it to handle the case where min/max were in the global namespace. I'm afraid I didn't make myself aware of the details before copying his code. Guillaume, what purpose is BOOST_NO_STDC_NAMESPACE serving here? -- Eric Niebler Boost Consulting www.boost-consulting.com

Le mar 02/03/2004 à 19:05, Eric Niebler a écrit :
John Maddock wrote:
The recent min max changes have caused breakages with vc7.1 + STLPort, the problem is that this configuration defines BOOST_NO_STDC_NAMESPACE (because STLPort doesn't quite manage to import everything into it's "fake" std namespace), which causes the following code:
template< typename T > inline T const & std_max( T const & a, T const & b ) { #if defined(__COMO__) || defined(BOOST_INTEL) || defined(BOOST_NO_STD_MIN_MAX) using std::max; #elif defined(BOOST_NO_STDC_NAMESPACE) using ::max; // <- error here #else using std::max; #endif return max BOOST_PREVENT_MACRO_SUBSTITUTION ( a, b ); }
to fail, because min and max *are* in namespace std. Now the thing is, BOOST_NO_STDC_NAMESPACE was only really designed to check for C lib functions, it was assumed that std lib functions like min and max are always in namespace std, are there any situations where that is not the case? If not we can just ditch the #elif defined(BOOST_NO_STDC_NAMESPACE) clause altogether.
Thanks for catching this John. I borrowed this preprocessor logic from the Interval library. In an earlier discussion, Guillaume suggested I use it to handle the case where min/max were in the global namespace. I'm afraid I didn't make myself aware of the details before copying his code.
Guillaume, what purpose is BOOST_NO_STDC_NAMESPACE serving here?
Good question... It never caused any problem (seems like nobody was using the interval library with both vc7.1 and stlport). However I don't remember the reason it was used for min/max. At first I thought it was necessary for G++ 2.95. But I did give it a try and it seems to handle "using std::min" even if it should be "using ::min" with this compiler (everything was in the root namespace). Let's remove it and see if it breaks anything. If it does, some compiler-specific test could be added rather than testing for NO_STDC. Regards, Guillaume

Guillaume Melquiond <guillaume.melquiond@ens-lyon.fr> writes:
At first I thought it was necessary for G++ 2.95. But I did give it a try and it seems to handle "using std::min" even if it should be "using ::min" with this compiler (everything was in the root namespace).
With 2.95 it isn't that simple. Some things really *are* in std::. It's just that 2.95 allows you to use them as though they were in ::. -- Dave Abrahams Boost Consulting www.boost-consulting.com

Guillaume Melquiond wrote:
Le mar 02/03/2004 à 19:05, Eric Niebler a écrit :
Guillaume, what purpose is BOOST_NO_STDC_NAMESPACE serving here?
Good question...
It never caused any problem (seems like nobody was using the interval library with both vc7.1 and stlport). However I don't remember the reason it was used for min/max. At first I thought it was necessary for G++ 2.95. But I did give it a try and it seems to handle "using std::min" even if it should be "using ::min" with this compiler (everything was in the root namespace).
If that's the case, then all this preprocessor logic can go away, and "using std::min;" is always the right thing to do. I'll check in the fix ASAP. -- Eric Niebler Boost Consulting www.boost-consulting.com
participants (5)
-
David Abrahams
-
Eric Niebler
-
Guillaume Melquiond
-
John Maddock
-
Martin Wille