一些曾經的奉爲經典的做法都被顛覆了



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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章