Monday, March 10, 2008

Big decimal integer constant warning


warning: this decimal constant is unsigned only in ISO C90

if there is no suffix added to the constant:

C90 compilers will follow the following order to read that constant:
  • int
  • long int
  • unsigned long int
while C99 compilers the following order:
  • signed int
  • signed long
  • signed long long
solution:
  1. consult compiler (gcc) documentation
  2. add proper suffix (ex. UL)
code snippet:


if((u64)s[i-1]>4294967295UL) {
s[i-1]=0;
}