Boost logo

Boost :

From: Moshe Matitya (Moshe.Matitya_at_[hidden])
Date: 2006-09-21 10:18:45


Michael Haubenwallner wrote:
>
> On HP-UX 11.11, there is a weird definition of WCHAR_MIN:
>
> $ grep WCHAR_MIN /usr/include/*.h
> /usr/include/wchar.h:# define WCHAR_MIN (wchar_t)0
>
> When using gcc-4.1.1 on this platform, each time WCHAR_MIN is
> tested by preprocessor-directive against zero, g++ spits:
>
> gcc-C++-action
> gcc-C++../../../bin/boost/libs/regex/build/libboost_regex.a/gc
> c/debug/c_
> gcc-C++regex_traits.o
> In file included from ../src/c_regex_traits.cpp:29:
> <snip>/boost_1_34_0rc/boost/regex/v4/regex_traits_defaults.hpp
:87:94: error: missing binary operator before token "0"
>
> This appears in
> boost/regex/v4/perl_matcher.hpp: line 53 and
> boost/regex/v4/regex_traits_defaults.hpp: line 87
>
> Both of them are hidden for aCC with "#if
> !defined(__HP_aCC)", so maybe they should also be hidden for
> gcc on hpux ?
>
> This problem does not appear with gcc-3.4.5 because of this:
>
> gcc-3.4.5 (don't exactly know until which version) did not
> define _INCLUDE__STDC_A1_SOURCE as builtin, which enables
> that definition of WCHAR_MIN in /usr/include/wchar.h
>
> Initially I had this with 1.33.0, but it is the same for rc-1.34.0.

The ISO C++ Standard [3.9.1] and the ISO C Standard [7.18.3] both
specify that WCHAR_MIN must be a "constant expression suitable for use
in #if preprocessing directives". HP/UX's definition of WCHAR_MIN does
not conform with this requirement, as the preprocessor has no idea what
to make of the expression "(wchar_t)0".

You can fix this as follows:

#include <wchar.h>
#undef WCHAR_MIN /* (wchar_t)0 */
#define WCHAR_MIN 0

Moshe


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