![]() |
![]() |
2120 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Integral promotion | REFERENCE - ISO:C90-6.2.1.1 Characters and Integers | ||||||
A bit-field of unsigned type is being converted to type signed int under the rules of integral promotion. This type of conversion will occur whenever an unsigned bit-field which is smaller than an int is used as an operand to one of the following operators:
| Unary | + - ~ |
| Multiplicative | * / % |
| Additive | + - |
| Bitwise Shift | << >> |
| Relational | < > <= >= |
| Equality | == != |
| Bitwise | & | ^ |
| Conditional | ? : (2nd and 3rd operands) |
/*PRQA S 2017,3131,3408,3447,3602,3621 ++*/
struct ST
{
unsigned int uib3:3;
unsigned int uib5:5;
};
extern struct ST stx;
extern signed int si;
extern void foo(void)
{
si = ~stx.uib3; /* Message 2120 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |