Keil Logo

C166: WARNING C192 (VALUE TRUNCATED)


Information in this article applies to:

  • C166 Version 4.25, or newer

QUESTION

With my C166 package, I sometimes receive the following message:

Warning C192: Value Truncated

The following example causes this warning:

unsigned char v;
unsigned char s;

v = (s & 0x0F) | ((s + 1) << 4) | 0x88;

The code still works. So, what does this warning mean and is it serious?

ANSWER

Warning C192 is issued because your statement generates a potential int value and the result gets truncated by the assignment to an unsigned char.

Avoid this warning with an explicit type cast like:

v = (unsigned char) ((s & 0x0F) | ((s + 1) << 4) | 0x88);

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Wednesday, November 18, 2020


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.