warning C4130: '==' : logical operation on address of string constant

環境:vs2010,c++

#define UNIT_FONTSIZE _T("rem")
if(UNIT_FONTSIZE == _T("rem"))
{
//...
}

代碼有警告:

warning C4130: '==' : logical operation on address of string constant

修改:

使用_tcscmp代替==進行判斷

if(_tcscmp(UNIT_FONTSIZE, _T("rem")) == 0)
{
//...
}

參考:https://stackoverflow.com/questions/30330446/having-problems-with-rand-in-c

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