They are not typesafe. Arguments of completely different types might be compared (like signed/unsigned), leading to unexpected behavior.
If an argument is an expression with side effects like x++, it might be evaluated twice, which may cause unintended behavior.
The Trespasser code already avoids those macros for the most part and undefines them in some strategic places.
The few remaining usages of the min/max macros are removed. The macro definitions from Windows.h are avoided by global definitions of the NOMINMAX macro and not using the minmax.h header.
An exemption is made for box2.h from the 3DS Max SDK, it gets a "scoped" definition of the min macro.
The macro versions of
min
/max
have two problems:signed
/unsigned
), leading to unexpected behavior.x++
, it might be evaluated twice, which may cause unintended behavior.The Trespasser code already avoids those macros for the most part and undefines them in some strategic places.
The few remaining usages of the
min
/max
macros are removed. The macro definitions fromWindows.h
are avoided by global definitions of theNOMINMAX
macro and not using theminmax.h
header. An exemption is made forbox2.h
from the 3DS Max SDK, it gets a "scoped" definition of themin
macro.