type casting problem
pdl at root44.UUCP
pdl at root44.UUCP
Sat Jun 11 02:24:53 AEST 1983
The reason you get sign extension is because you `char's should be `unsigned char',
this solves the problem (the code shown converts a signed char to an unsigned
larger integer, so sign extension MAY occur (not that `char' may be signed
or unsigned at the whim of the compiler writer.)
I know of no compiler that disallows `unsigned char' these days,
so why not keep it simple (you don't need ANY casts, then !)
Per ardua ad portability
Dave Lukes
...!vax135!ukc!root44!pdl
More information about the Comp.lang.c
mailing list