简体   繁体   中英

Gcc compiler suppress comparison warning

I getting below warning. How to suppress this warning?

Warning:

warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'unsigned int'} and 'int' [-Wsign-compare]

Code:

DWORD exp = GetExp();
int amount = 20;

if (amount < 0 && exp < -amount)
{
...
}

If you really want to suppress it (it's not recommended, there is a reason a warning is shown, and you should instead eliminate the reason), you can do it by adding -Wno-sign-compare to the gcc command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM