Ticket #3901 (closed Bugs: fixed)
ASIO and macro min and max on Windows
|Reported by:||habdank@…||Owned by:||chris_kohlhoff|
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