Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2004-07-14 04:19:49


On Tue, Jul 13, 2004 at 03:24:57PM -0400, Gennadiy Rozental wrote:

>
> > IMO, there's nothing wrong with using namespace std; in local
> > scope. Here's a fix:
>
> There is already workaround on top of the file dealing with gcc 3.3. I
> wonder why is that gcc does not put namely wcscmp into namespace std or why
> BOOST_NO_STDC_NAMESPACE is not defined?

The workaround applies to all versions of GCC 3.3, but I think that
wcscmp is missing from std on any GCC version iff the standard library is
not configured with wchar support. If libstdc++ is configured without
wchar support then there will be no using declarations to pull the wchar.h
names into std. Simplified, cwchar looks like this:

#include <wchar.h>

#if _GLIBCPP_USE_WCHAR_T
namespace std
{
    // ...
    using ::wcscat;
    using ::wcscmp;
    using ::wcscoll;
    // ...
}
#endif

(N.B. for GCC 3.4 and later the macro is called _GLIBCXX_USE_WCHAR_T)

> We need to figure out what is going on and then upddate above mentioned
> workaround.

The workaround should make use of the BOOST_NO_CWCHAR macro, which is
set if _GLIBCPP_USE_WCHAR_T / _GLIBCXX_USE_WCHAR_T is not set (see
boost/config/stdlib/libstdcpp3.hpp)

Maybe something like this (but using BOOST_WORKAROUND):

#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR )
namespace std { using ::wcscmp; }
#endif

Although this isn't quite right, as it only tests for GCC, but it's the
stdlib that affects the availablity of std::wcscmp (i.e. GCC with
STLPort wouldn't be affected AFAICT)

jon

-- 
"Once, during Prohibition, I was forced to live for days on nothing but 
 food and water."
	- W.C. Fields

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