Boost logo

Boost :

From: Ross Smith (ross.s_at_[hidden])
Date: 2001-05-23 18:58:55


Recent changes to Cygwin have created minor breakage in Boost's limits
header. The code for wchar_t currently looks like this:

#ifndef _WIN32
template<>
class numeric_limits<wchar_t>
  : public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
{};
#else
class numeric_limits<wchar_t>
  : public _Integer_limits<wchar_t, 0, USHRT_MAX>
{};
#endif

Translation: assume equivalence to unsigned short on Windows, signed int
on anything else. This falls down now because Cygwin's GCC defaults to
-mno-win32 mode, in which _WIN32 isn't defined but wchar_t is still 16
bits.

The fix should be trivial:

#if defined(_WIN32) || defined(__CYGWIN__)
template<>
class numeric_limits<wchar_t>
  : public _Integer_limits<wchar_t, 0, USHRT_MAX>
{};
#else
template<>
class numeric_limits<wchar_t>
  : public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
{};
#endif

(I've also inserted the missing template<> on the 16-bit version;
presumably it was left out by accident and compilers were prepared to be
be forgiving about it.)

-- 
Ross Smith <ross.s_at_[hidden]> The Internet Group, Auckland, New Zealand
========================================================================
        "Hungarian notation is the tactical nuclear weapon of
         source code obfuscation techniques." -- Roedy Green

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