Boost logo

Boost :

From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2005-05-06 10:49:24


The title says it all: the Mac OS X system headers are inconsistent
about the minimum value of a wchar_t. The C++ <limits> header has it
right, but the definition of WCHAR_MIN in <cwchar>/<wchar.h> is wrong
(0). If there are no complains, I'm going to commit the following
patch. I don't believe this will affect CodeWarrior on the Mac, but I
can't test against it.

Index: integer_traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/integer_traits.hpp,v
retrieving revision 1.26
diff -u -r1.26 integer_traits.hpp
--- integer_traits.hpp 17 Dec 2004 11:56:15 -0000 1.26
+++ integer_traits.hpp 6 May 2005 15:46:36 -0000
@@ -88,7 +88,9 @@
  template<>
  class integer_traits<wchar_t>
    : public std::numeric_limits<wchar_t>,
-#if defined(WCHAR_MIN) && defined(WCHAR_MAX)
+ // Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native
+ // library: they are wrong!
+#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__)
      public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX>
  #elif defined(__BORLANDC__) || defined(__CYGWIN__) ||
defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__))
      // No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned:

        Doug


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