About the use of the Max (A, B) and Min (A, B) functions in VS2013
These two functions in the header file <algorithm> will return a and B in the smaller/larger one.
Can not be changed to _min and _max. Check that you can replace this in Windows engineering
Website: https://zhidao.baidu.com/question/135498020.html
For the use of Linux and VC6, copy the answer to a post in CSDN
First, Max () is really a function rather than a macro in standard C + +. It is actually defined in different compilation systems as follows:
===========================================================
Linux g++, header files <algorithm>
Template <class _tp>
Inline const _tp& MAX (const _tp& __a, const _tp& __b) {
Return __a < __b? __b: __a;
}
===========================================================
VC6 under Windows, header file <algorithm> (latest vs.net not tried, dare not to be raved)
Template<class _ty> Inline
Const _ty& _cpp_max (const _ty& _x, const _ty& _y)
{return (_x < _y _y: _x);}
===========================================================
Did you see it? g++ defined it as Max () according to standard C + +, and VC6 made it into a _cpp_max ().
In fact, the source code I attached to my question was in accordance with the standard C + + rules and was compiled successfully under g++, and because VC6 changed Max () to _cpp_max (), it failed to compile.
To use Max () in VC6, you can only retreat to the second using _cpp_max (). or _max ().
Because in the header file algorithm contains another header file xutility There is a sentence #define _max _cpp_max
There is also a related macro __max, which is defined in Stdlib.h: #define __MAX (A, B) (((a) > (a))? (a): (b)), but __max is not standard C + +, which was left by the previous C.