Boost logo

Boost :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2004-03-02 14:35:34


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk