float a = 0.0f;
if (a==0.0f)
{
std::cout << "yes" << std::endl;
}
if (a==0)
{
std::cout << "yes" << std::endl;
}
int b = 0;
if (a==b)
{
std::cout << "yes" << std::endl;
}
float c = 0.0f;
if (a==c)
{
std::cout << "yes" << std::endl;
}
输出4个yes
编译器采用:Intel C++ Compiler XE 14.0, vs2010
win7 64位
Corei5 4760K