草庐IT

c++ - std::numeric_limits<double>::min() 上的错误 C2589

当我尝试编译一些代码(不是我自己的代码)时,我得到一个C2589'(':'::'右侧的非法标记在这一行:maxPosition[0]=std::numeric_limits::min();我想这是因为已经定义了一个min()宏,但为什么编译器不从指定的命名空间中获取min()而不是宏? 最佳答案 butwhyisthecompilernottakingthemin()fromthespecifiednamespaceinsteadofthemacro?因为宏不关心您的namespace、语言语义或您的编译器。预处理首先发生。换句话说

c++ - 警告 C4003 和错误 C2589 和 C2059:x = std::numeric_limits<int>::max();

此行在一个小型测试程序中正常工作,但在我想要它的程序中,我收到以下编译器投诉:#includex=std::numeric_limits::max();c:\...\x.cpp(192):warningC4003:notenoughactualparametersformacro'max'c:\...\x.cpp(192):errorC2589:'(':illegaltokenonrightsideof'::'c:\...\x.cpp(192):errorC2059:syntaxerror:'::'我得到了相同的结果:#includeusingnamespacestd;x=numeri