Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2003-08-18 13:52:20


Fernando Cacciola wrote:
> Recently, Jens Maurer changed the guard at function scope
> from:
>
> #ifndef __GNUC__
> to
> #ifndef BOOST_NO_STDC_NAMESPACE
>
> and honestly, I didn't looked much at it as I should.
>
> BOOST_NO_STDC_NAMESPACE is documented to relate to C names,
> but swap is a C++ name so I don't think such macro
> should be used here.

The CVS change of optional.hpp:1.10 is definitely incorrect,
because STDC_NAMESPACE refers to C names, not C++ names.
Sorry.

However, just reverting the patch will make gcc-3.3
non-functional, because std::swap(int,int) (for example)
is not going to be found.

I've checked in a better fix to the main branch. optional_test.cpp
now works with gcc 2.95, gcc 3.0 and gcc 3.3 on Linux.
Please test on other platforms and (optionally) transport
the fix to the 1.30.0 CVS branch.

Jens Maurer

RCS file: /cvsroot/boost/boost/boost/optional.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- optional.hpp 14 Mar 2003 12:56:01 -0000 1.9
+++ optional.hpp 9 Jul 2003 23:13:40 -0000 1.10
@@ -296,7 +296,8 @@
   }
   else if ( !!x && !!y )
   {
-#ifndef __GNUC__
+#ifndef BOOST_NO_STDC_NAMESPACE
+ // allow for Koenig lookup
     using std::swap ;
 #endif
     swap(*x,*y);


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