ARM Technical Support Knowledge Articles

WARNING C192 (VALUE TRUNCATED)

Applies to: C166 C Compiler

Answer


Information in this article applies to:


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

Article last edited on: 2004-04-24 12:18:25

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential