18-12-2014, 05:55 PM
I am using Parasoft's C++ test and I'm getting a line flagged. The code is as follows:
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!
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>