Synopsis: | Use parentheses to improve readability of the conditional operator. |
Language: | C |
Severity Level: | 6 |
Category: | EXPRESSIONS |
Description: |
Parenthesizing the operands of the conditional operator can help readability. Hence, Example: len = ac_DataLength <= 3 ? ac_DataLength - 1 : ac_DataLength + 1; should become Example: len = (ac_DataLength <= 3) ? (ac_DataLength - 1) : (ac_DataLength + 1); If the operands are atomic expressions no parentheses are needed. For instance the following is allowed. Example: len = (ac_DataLength <= 3) ? ac_DataLength : 3; |