[previous] 2109 [next] Integral promotion : _Bool promoted to signed int.
Arithmetic type - Integral promotion REFERENCE - ISO:C99-6.3.1.1 Boolean, characters, and integers

An operand of Boolean type is being converted to type signed int under the rules of integral promotion.

This type of conversion will occur whenever an expression of Boolean type is used as an operand of the following operators:

Unary + - ~
Multiplicative * / %
Additive + -
Bitwise Shift << >>
Relational < > <= >=
Equality == !=
Bitwise & | ^
Conditional ? : (2nd and 3rd operands)

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 2109 --*/

extern _Bool ba;
extern _Bool bb;
extern signed int  si;

extern void foo(void)
{
    si = ba + bb;                             /* Message 2109 */
    if (ba == bb)                             /* Message 2109 */
    {
    }
}


No MISRA C:2012 Rules applicable to message 2109


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