[previous] 2900 [next] Constant: Positive integer value truncated by implicit conversion to a smaller unsigned type.
Conversion to unsigned

The value of a non-negative integer constant expression is being implicitly converted to an unsigned type. The value of the expression is larger than the maximum value which can be represented in this type and so truncation will occur using modulo arithmetic.

For example:


/*PRQA S 1255,2017,3120,3211,3306,3408,3606 ++*/


unsigned char  uca = 255;                 /* OK   */
unsigned char  ucb = 256;                 /* 2900 */
unsigned short usa = 65535;               /* OK   */
unsigned short usb = 65536;               /* 2900 */

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents