此行在一个小型测试程序中正常工作,但在我想要它的程序中,我收到以下编译器投诉:
#include <limits>
x = std::numeric_limits<int>::max();
c:\...\x.cpp(192) : warning C4003: not enough actual parameters for macro 'max'
c:\...\x.cpp(192) : error C2589: '(' : illegal token on right side of '::'
c:\...\x.cpp(192) : error C2059: syntax error : '::'
我得到相同的结果:
#include <limits>
using namespace std;
x = numeric_limits<int>::max();
为什么将 max 视为宏 max(a,b); ?