K
Kenny McCormack
Aka, "How to make this warning go away?"
I have some code that contains:
#define FOO 2123456789L
I.e., a number that is greater than the limit for a signed 32 bit int.
I cannot use the above in a statement w/o compiler (gcc 2.95) issuing
a warning that says: decimal constant so large it must be unsigned.
For example:
unsigned int baz = FOO;
Should be OK, right?
Notes:
1) This is on a machine where ints and longs are both 32 bits.
2) I get same results with "long" instead of "int" (in the above
declaration).
Also, I tried:
#define FOO 2000000000L+123456789L;
And I get a different error (error this time) saying integer overflow...
I assume somewhere in the standard it says that compiletime math has to
work up to some level, right?
I have some code that contains:
#define FOO 2123456789L
I.e., a number that is greater than the limit for a signed 32 bit int.
I cannot use the above in a statement w/o compiler (gcc 2.95) issuing
a warning that says: decimal constant so large it must be unsigned.
For example:
unsigned int baz = FOO;
Should be OK, right?
Notes:
1) This is on a machine where ints and longs are both 32 bits.
2) I get same results with "long" instead of "int" (in the above
declaration).
Also, I tried:
#define FOO 2000000000L+123456789L;
And I get a different error (error this time) saying integer overflow...
I assume somewhere in the standard it says that compiletime math has to
work up to some level, right?