Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2003-10-31 05:21:18


Edward Diener <eddielee_at_[hidden]> wrote:
> John Maddock wrote:
> > Guys,
> >
> > We could of course create a new build variant to handle this, but
> > with 8 regex lib/dll variants already I'm not keen to add another 8
> > (apart from anything else testing already takes too long).
>
> I think you have to do this John if you want to support both the C++
> wchar_t and the MS wchar_t in Boost libraries. Although there are
> VC++ predefined macros, _WCHAR_T_DEFINED and _NATIVE_WCHAR_T_DEFINED,
> which are defined when /Zc:wchar_t is used, they are also stupidly
> defined, according to the documentation, when typedef unsigned short
> wchar_t is used ( talk about idiotic MS decisions ).

That appears to be a documentation bug. I checked this in VC++ 7.1
and _NATIVE_WCHAR_T_DEFINED is not defined by <cstddef>. There is no
sign of a #define _NATIVE_WCHAR_T_DEFINED in the headers for version
7.0 or 7.1.

> So Boost needs to use a macro which the end-programmer must define
> which tells whether or not /Zc:wchar_t is being used or not, and
> create another set of libraries accordingly.

Even in the absence of a macro, this test works:

    #include <cstddef>
    #include <iostream>
    #include <ostream>
    #include "boost/type_traits.hpp"

    int main()
    {
        std::cout << "/Zc:wchar_t was ";
        if (!boost::is_same<wchar_t, __wchar_t>::value)
            std::cout << "not ";
        std::cout << "used\n";
    }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net