Ali
Ali

Reputation: 11

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)
{
...
}

Upvotes: 0

Views: 653

Answers (1)

TheEagle
TheEagle

Reputation: 5992

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.

Upvotes: 2

Related Questions