Undefining min and max macros
c++, c-preprocessor
Solution
Some MSVC header has pre-processor macros to define `min` and `max`. This is bad for many reasons. First, they are not reserved names, second, there are standard library functions with the same names.
So MSVC or whatever was breaking the rules and code by defining `min` and `max` as macros, and the use of `undef` is a work-around to fix that problem.
See this related question, which shows how the defines can break code.
Problem
In a source code, I saw that min and max were being undefined. What could be the reason for that? ``` // remove stupid MSVC min/max macro definitions #ifdef WIN32 #undef min #undef max #endif ```