Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A5-2-6 about operands consisting of a sequence of only `&&` or `||`
#1
Quote:A5-2-6 (Required) : The operands of a logical && or \\ shall be parenthesized if the operands contain binary operators.

What about those cases whose oeprands consists of either a sequence of only logical && or ||?
Code:
void f()
{
    int a, b, c, d;
    if ((a < b) || (b < c) || (c < d)) // compliant or noncompliant
    {
    }
}
This should be a exceptional case for MISRA C++-2008 Rule 5-2-1 ( Each operand of a logical && or || shall be a postfix-expression ), does this exception apply for A5-2-6 either?
Reply


Messages In This Thread
A5-2-6 about operands consisting of a sequence of only `&&` or `||` - by zhaohui - 19-08-2022, 06:21 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)