-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine integer conversions in unsigned_integral_max_value #78
Comments
This seems to require the NOMINMAX preprocessor definition. I'd suggest adding that with the check for if its already defined before wherever windows.h is included, if in fact it is included. Perhaps it isn't in the GIL library and its just my large project, but I'm running into issues when I need both this to compile and code using the standard MAX macro. Edit: |
Yes, Windows SDK/MSVC, in many, if not most uses of
AFAICT, nowhere in GIL the Line 41 in c3e84ad
Line 88 in c3e84ad
IMO, it is not GIL or Boost or other C++ library duty but a library's user duty to
Alternatively, we may consider adding very similar check and warning somewhere in |
Thanks for getting back to me so quickly. I agree with your opinion that it is on the library user to handle this, I'll look into defining NOMINMAX for my project. I was doing so until I came across an error where we're using what I think is a standard definition of max, in another library, that won't compile with NOMINMAX defined. So feels like a catch 22 between using GIL and this other library. We're using Boost-gil 1.70 from Vcpkg by the way. My vote would be for the "function-like macro suppression with extra parenthesis" but in the meantime I'll try to find all the Windows headers and define NOMINMAX before including them. Thanks, |
I've searched through the code and apparently GIL already uses this technique in numerous places, e.g. gil/include/boost/gil/color_convert.hpp Lines 147 to 148 in c3e84ad
as well as explicit template parameter to suppress the macro: gil/include/boost/gil/algorithm.hpp Line 975 in c3e84ad
Please, consider contributing a pull request with similar fixes that will help your project. |
As per Andrey Semashev's suggestion https://lists.boost.org/Archives/boost/2018/04/242013.php,
since we switched to C++11, it may be a good idea to
constexpr std::numeric_limits<UnsignedIntegralChannel>::max()
#include <boost/integer_traits.hpp>
Comments?
The text was updated successfully, but these errors were encountered: