在VS中,有如下代碼
char title[2];
title[0] = 0xEB;
title[1] = 0x90;
生成解決方案時,出現了警告“warning C4309: “=”: 截斷常量值”,這是因爲0xEB默認爲有符號int型,
解決方案是在後面加u,使其默認爲無符號int型,警告消失
title[0] = 0xEBu;
title[1] = 0x90u;
在VS中,有如下代碼
char title[2];
title[0] = 0xEB;
title[1] = 0x90;
生成解決方案時,出現了警告“warning C4309: “=”: 截斷常量值”,這是因爲0xEB默認爲有符號int型,
解決方案是在後面加u,使其默認爲無符號int型,警告消失
title[0] = 0xEBu;
title[1] = 0x90u;