
In message 54305.216.110.51.8.1080245554.squirrel@www.orkun.us you wrote:
But we agree that the conversion "unsigned char" ==> "unsigned int" must result in exactly the same result, no matter if done implicitely or by explicit cast?
...
I agree, unsigned char should be promoted to unsigned int.
Must, not should.
However, char can be unsigned or signed depending on the platform. On a
But the variable in question was of type "unsigned char", which leaves no room for implementation-specific behaviour.
before passing it to printf. So, a value like 0xC2 (-62 as 8-bit value)
We are talking about a format element which expects an "unsigned int" argument, and an "unsigned char" argument. There was no constant expression involved.
with twos complement arithmetic. %02X can only suppress leaving zeros so additional f's will be printed.
Oops? %02X will _add_ leading zeroes if the result is too short, but it will never supress anything.
[Maybe we should take this to c.l.c ;-)]
Best regards,
Wolfgang Denk