AnsweredAssumed Answered

Implicit arithmetic conversion

Question asked by William Hookway on Jun 17, 2010
Latest reply on Jun 24, 2010 by William Hookway



I have the following code:


unsigned char xx;


xx |= 4;             No conversion errors


xx = xx | (unsigned char)4;          Generates implicit arithmetic conversion from 'int' to 'unsigned char'


Compiling for the 51JM128.

It appears as if the unsigned char is being treated as a int regardless of the cast.

In the C/C++ compiler settings I have the Use Unsigned Chars check box checked.

I'm using the CW IDE 5.9.0, build 5292.

I do not want to turn off the Implicit Arithmetic Conversions warnings globally.

Why can't this error be explicitly cast away?