# HG changeset patch # User Sebastien Jodogne # Date 1794136089 -3600 # Node ID b8b8934e9cd6b7eaf7bdbcc3486603917813af72 # Parent 6c2eb64bd7939f37cd80f10ef1e12fee64920d4d added robustness against Microsoft's min and max macros diff -r 6c2eb64bd793 -r b8b8934e9cd6 OrthancFramework/Sources/CompatibilityMath.h --- a/OrthancFramework/Sources/CompatibilityMath.h Sun Nov 08 11:06:48 2026 +0100 +++ b/OrthancFramework/Sources/CompatibilityMath.h Sun Nov 08 12:08:09 2026 +0100 @@ -31,6 +31,23 @@ #include "Compatibility.h" +#if defined(_WIN32) +/** + * defines function-like min/max macros that break + * std::min(), std::max(), or std::numeric_limits::max(). Undefine + * them right after the include so they cannot interfere with the rest + * of the code. + **/ +# include +# if defined(min) +# undef min +# endif +# if defined(max) +# undef max +# endif +#endif + + #ifdef __EMSCRIPTEN__ /* Avoid such errors: