Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with MISRA C 2012 Rule 13.5
#1
I am using Parasoft's C++ test and I'm getting a line flagged. The code is as follows:

Code:
if((padcValue1 = 4902)||(padcValue2 = 4902))  /* Error on this line here */
{
    LogFailure(FlagStartupDACTest);
    StartupFail = 1;
}

The error says "Do not use expressions with side effects in the right-hand operand of a logical operator". Is it saying I can't use multiple or cases or is the concern about making it coded so it's easier to test for MC/DC? I can break it up further but it just seems like an inefficient way to code it (unless there's an added benefit or I'm missing the intent of the code).

Any help you can give me would be greatly appreciated! Thanks!
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)