Technical Support

C166: WARNING C192 (VALUE TRUNCATED)


Information in this article applies to:

  • C166 Version 4.25 or higher

QUESTION

I have just upgraded my C166 package. With this new version 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 has been recently introduced into the C166 compiler. It is issued because your statement generates a potential int value and the result gets truncated by the assignment to an unsigned char.

You can avoid this warning with an explicit type cast like:

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

SEE ALSO

Last Reviewed: Saturday, April 24, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure