环境: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