[Boost-bugs] [Boost C++ Libraries] #3901: ASIO and macro min and max on Windows

Subject: [Boost-bugs] [Boost C++ Libraries] #3901: ASIO and macro min and max on Windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-04 15:49:22


#3901: ASIO and macro min and max on Windows
-------------------------------+--------------------------------------------
 Reporter: habdank@… | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: asio
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 Dears,

 There is little problem with ASIO on windows.
 ASIO is using windows.h header.
 That header defines "min" and "max" macros.

 So immediately asio is conflicting with standard
 <limits> and <algorithm> headers.

 The error generated by the compilers is higlhy not readable.
 Also regular user of the asio does not know that windows.h
 is included and pollute standard C++ code with mentioned
 macros.

 Try to use
 ::std::numeric_limits<int>::min()
 ::std::numeric_limits<int>::max()
 as well as
 ::std::min()
 together with ASIO.

 For users would be perfect if you
 could simply put
 #undef min
 and
 #undef max
 just after inclusion of any windows.h
 file.

 The problem is more complicated because the
 same code is working on Linux,
 so from C++ portable code it is uncomfortable
 to have such a intrusions.

 Best regards,
 Seweryn Habdank-Wojewodzki

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3901>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC