
This is with mingw-2.0 c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope #if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

David Abrahams wrote:
This is with mingw-2.0
c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
There's boost/compatibility/cpp_c_headers/cwctype and boost/compatibility/cpp_c_headers/cctype. Can we use those instead and be assured of portability? Everyone seems to be reinventing workarounds for these nasty little beasts. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

There's boost/compatibility/cpp_c_headers/cwctype and boost/compatibility/cpp_c_headers/cctype. Can we use those instead and be assured of portability? Everyone seems to be reinventing workarounds for these nasty little beasts.
No those headers will not compile on conforming compilers (Metrowerks and Borland spring to mind) which really do place definitions in namespace std to begin with. John.

This is with mingw-2.0
c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
This is the line that was changed yesterday to handle no wcscmp in namespace std sometimes. According to an analysis here http://tinyurl.com/3kmyz above supposed to work. Now what are the possible issues are: 1. BOOST_NO_CWCHAR got defined, while it shouldn't. Why is that? 2. Analysis is not completely correct. What is a complete solution? Gennadiy.

Gennadiy Rozental wrote:
This is with mingw-2.0
c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already
declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
This is the line that was changed yesterday to handle no wcscmp in namespace std sometimes. According to an analysis here http://tinyurl.com/3kmyz above supposed to work. Now what are the possible issues are:
1. BOOST_NO_CWCHAR got defined, while it shouldn't. Why is that? 2. Analysis is not completely correct. What is a complete solution?
Whatever the solution is, I'd like to see it placed in boost/compatibility/cpp_c_headers/cwctype and boost/compatibility/cpp_c_headers/cctype. for everyone to benefit. This is a common problem. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
This is the line that was changed yesterday to handle no wcscmp in namespace std sometimes. According to an analysis here http://tinyurl.com/3kmyz above supposed to work. Now what are the possible issues are:
1. BOOST_NO_CWCHAR got defined, while it shouldn't. Why is that? 2. Analysis is not completely correct. What is a complete solution?
If BOOST_NO_CWCHAR is defined then you shouldn't be using wcscmp or any other wide character API at all. It's probably set because the std lib isn't set up with wide character support (neither _GLIBCPP_USE_WCHAR_T nor _GLIBCXX_USE_WCHAR_T is defined). John.

On Fri, Jul 23, 2004 at 12:16:37PM +0100, John Maddock wrote:
c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
This is the line that was changed yesterday to handle no wcscmp in namespace std sometimes. According to an analysis here http://tinyurl.com/3kmyz above supposed to work. Now what are the possible issues are:
1. BOOST_NO_CWCHAR got defined, while it shouldn't. Why is that? 2. Analysis is not completely correct. What is a complete solution?
If BOOST_NO_CWCHAR is defined then you shouldn't be using wcscmp or any other wide character API at all.
That was my first thought, but I thought since it's being used, it should be done as well as possible. The previous test was for GCC 3.3, which must have been wrong for even more environments, since the relevant parts of GCC haven't changed between 3.3 -> 3.4 AFAIK.
It's probably set because the std lib isn't set up with wide character support (neither _GLIBCPP_USE_WCHAR_T nor _GLIBCXX_USE_WCHAR_T is defined).
That's certainly the case on FreeBSD 4. But because that file #includes <wchar.h> rather than <cwchar> wcscmp() _is_ available, so I tried to make it work. Probably shouldn't have tried. Sorry. jon -- "God not only plays dice, he also sometimes throws the dice where they cannot be seen." - Steven Hawking

On Fri, Jul 23, 2004 at 10:33:59AM -0400, Gennadiy Rozental wrote:
make it work. Probably shouldn't have tried. Sorry.
Why? I am really grateful for your analysis.
The analysis might have been ok, but my fix wasn't! :-) I've been trying to contribute some little fixes all week, but without having time to do it properly I've been a bit sloppy. jon -- "A woman drove me to drink, I never had the courtesy to thank her." - W.C. Fields

c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
That's doubly wrong: it should check for BOOST_NO_STDC_NAMESPACE, and if BOOST_NO_CWCHAR is defined then wcscmp may not exist anyway. John.

On Fri, Jul 23, 2004 at 12:10:14PM +0100, John Maddock wrote:
c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
That's doubly wrong: it should check for BOOST_NO_STDC_NAMESPACE, and if BOOST_NO_CWCHAR is defined then wcscmp may not exist anyway.
The problem I was trying to solve is that on systems where libstdc++ doesn't support wide chars and wide streams wcscmp() and friends might be present in <wchar.h>, but <cwchar> will not have a using declaration for them, pulling them into namespace std. e.g. on FreeBSD 4 <wchar.h> declares wcscmp(), but because it doesn't declare wcrtomb() and others, so libstdc++ disables all wide char support, and <cwchar> doesn't pull any of the wide char functions into std. This is on the case for GCC 3.x on FreeBSD 4, where BOOST_NO_STDC_NAMESPACE is not defined. Unfortunately this breaks mingw, which (it seems) has BOOST_NO_CWCHAR, but somehow stil declares std::wcscmp(). jon -- "Consistency is the last refuge of the unimaginative." - Oscar Wilde

"John Maddock" <john@johnmaddock.co.uk> wrote in message news:048b01c470a6$c36402d0$73e70352@fuji...
c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already declared in this scope
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } <===================== here #endif
That's doubly wrong: it should check for BOOST_NO_STDC_NAMESPACE, and if BOOST_NO_CWCHAR is defined then wcscmp may not exist anyway.
John.
Related region in a code look like this: # ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::strcmp; using ::wcscmp; using ::strlen; using ::isprint; } # endif #if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } #endif Any suggestions? Gennadiy.

Related region in a code look like this:
# ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::strcmp; using ::wcscmp; using ::strlen; using ::isprint; } # endif
#if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) namespace std { using ::wcscmp; } #endif
Any suggestions?
# ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::strcmp; using ::wcscmp; using ::strlen; using ::isprint; #if !defined( BOOST_NO_CWCHAR ) using ::wcscmp; #endif } # endif Of course you also have to make sure that you only use std::wcscmp when BOOST_NO_CWCHAR is not defined. John.
participants (5)
-
David Abrahams
-
Gennadiy Rozental
-
Joel de Guzman
-
John Maddock
-
Jonathan Wakely