"msolem" <msolem@[EMAIL PROTECTED]
> wrote in message
news:1134752029.820021.269860@[EMAIL PROTECTED]
> Ok, that makes sense, thanks. The warning does disappear if I do this:
> var = (char)(var / 2);
>
> But if it's the constant 2 that's causing the promotion, shouldn't this
> also compile warning free (which it doesn't):
> var = var / (char)2
>
> I see that the HCS12 has no 8 bit divide assembly instruction. So in
> some
> sense I guess it gets promoted to 16 bit no matter what. Is that why
> that line still produces the warning?
>
> Mike
Try changing the 2 to a char differently:
char var;
const char TWO = 2;
....
var = var/TWO;
There should be no promotion/demotion doing it that way, as both are
chars.
If you read the manual, you would know that you could change the warning
to
a different type of message, such as "information".
I could try it myself, but you could do it before I get to it. I'll try it
later and see, though.


|