Reputation: 29
stackoverflowers :> (Can i say that? :| )
OK... this time i want to know if this warning should be solved, or should be ignored.
It represent the number of experience needed for advancing at next level. (for a game)
This is the error: warning: this decimal constant is unsigned only in ISO C90
And this is the file: ( I will show just a part of the code, it is pretty much long :D.)
const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =
{
2150000000, // 100
2210000000,
2250000000,
2280000000,
2310000000,
2330000000, // 105
2350000000,
2370000000,
2390000000,
2400000000,
2410000000, // 110
2420000000,
2430000000,
2440000000,
2450000000,
2460000000, // 115
2470000000,
2480000000,
2490000000,
2490000000,
2500000000, // 120
};
This are just the warned rows.
Upvotes: 0
Views: 3253
Reputation: 153547
In C90, a decimal constant gets the type it first fits into
int, long, unsigned long
In C99 onward, a decimal constant gets the type it first fits into
int, long, long long
In your system, 2150000000
is bigger than LONG_MAX
(certainly 2147483647). So with a C90 compiler, it is unsigned long
. With current compilers, it is long long
.
Should you ignore? It depends on subsequent code. Recommended to not ignore and explicitly declaring the decimal constant as an unsigned one by appending the u
suffix like 2500000000u
.
Upvotes: 3