azure-sdk-for-cpp
azure-sdk-for-cpp copied to clipboard
Re-evaluate the use of the `NOMINMAX` coding pattern when including Windows.h across the SDK
From @LarryOsterman:
We should never define
NOMINMAX, instead you should use the(min)trick Anton used.
I understand that this is not one of our headers, but we should get out of the habit of using
minand instead use(min)throughout the SDK. For better or worse, our customers absolutely can (and will) include windows.h before they include our SDK headers, which means that the NOMINMAX definition will be irrelevant, since the min and max macros would have already been defined.
An alternative is to include a
#undef minat the beginning of source files, possibly as:
#if defined(min)
#undef min
#endif
to make the removal of the macro explicit.
That way we relegate the use of the
(min)pattern to our headers only (where we cannot control what our customers have previously included).