Simplicity concept
- Logical operations can always be written in many ways.
- Choose the form that is easiest to understand.
- Keep it simple
Example:
MISRA rules
MISRA-C:2004, Rule 12.4: The right-hand operand of a logical && or || shall notcontain side effects.
MISRA-C:2004, Rule 12.5: The operands of a logical && or || shall be primary
expressions.
– i.e. constants or parenthesized.
MISRA-C:2004, Rule 12.6: The operands of logical operators shall be effectively
Boolean.
– i.e. serve a boolean purpose