.... but I have an unsigned long value in the printf.
This warning came when I used gcc 4.x to compile.
....
unsigned long offset = 0;
....
Well OK, an "easy" way would be instead of
printf ("eof found at offset %08x", offset);
to do a type cast like
printf ("eof found at offset %08x", (unsigned int) offset);
Fine, but is this supposed to work for values like 0xFFFFFFFF, which is
afaik the last possible long value. Unsigned int only goes to 0xFFFF.
So if I think before going the trial-and-error way, I conclude it's better
to ignore the warning and skip the type cast.
Because just by logic, it cannot work with an (unsigned int) typecast for
the whole ulong range 0x00000000..0xF FFFFFFF.
-Andreas
This warning came when I used gcc 4.x to compile.
....
unsigned long offset = 0;
....
Well OK, an "easy" way would be instead of
printf ("eof found at offset %08x", offset);
to do a type cast like
printf ("eof found at offset %08x", (unsigned int) offset);
Fine, but is this supposed to work for values like 0xFFFFFFFF, which is
afaik the last possible long value. Unsigned int only goes to 0xFFFF.
So if I think before going the trial-and-error way, I conclude it's better
to ignore the warning and skip the type cast.
Because just by logic, it cannot work with an (unsigned int) typecast for
the whole ulong range 0x00000000..0xF FFFFFFF.
-Andreas
Comment