Undefining min and max macros

In the source code, I saw that min and max were undefined. What could be the reason for this?

// remove stupid MSVC min/max macro definitions
#ifdef WIN32
   #undef min
   #undef max
#endif
+4
source share
1 answer

Some MSVC headers have preprocessor macros to determine minand max. This is bad for many reasons. Firstly, they are not reserved names, and secondly, there are standard library functions with the same name.

So, MSVC or something violated the rules and code, defining minit maxas macros, and use undefis a workaround to fix this problem.

. , , , .

+7

Source: https://habr.com/ru/post/1524718/


All Articles