![]() |
![]() |
2905 | ![]() |
||||
![]() | |||||||
| Conversion to unsigned | |||||||
The value of a non-negative integer constant expression is being cast 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 = (unsigned char)255; /* */
unsigned char ucb = (unsigned char)256; /* 2905 */
unsigned short usa = (unsigned short)65535; /* */
unsigned short usb = (unsigned short)65536; /* 2905 */
No MISRA C:2012 Rules applicable to message 2905
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |