![]() |
![]() |
2102 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Integral promotion | REFERENCE - ISO:C90-6.2.1.1 Characters and Integers | ||||||
An operand of type unsigned char is being converted to type unsigned int under the rules of integral promotion. This type of conversion will only occur if type char is the same size as type int and an expression of type char is used as an operand of the following operators:
| Unary | + - ~ |
| Multiplicative | * / % |
| Additive | + - |
| Bitwise Shift | << >> |
| Relational | < > <= >= |
| Equality | == != |
| Bitwise | & | ^ |
| Conditional | ? : (2nd and 3rd operands) |
/*PRQA S 3408,3447,3602 ++*/
/*************************************
* OPTIONS: -s char=16 -s int=16
************************************/
extern unsigned char ua;
extern unsigned char ub;
extern unsigned char ur;
extern unsigned int ui;
extern void foo(void)
{
ur = ua + ub; /* Message 2102 */
ui = ~ur; /* Message 2102 */
}
No MISRA C:2012 Rules applicable to message 2102
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 |