MISRA.ASSIGN.SUBEXPRAssignment operator is used in sub-expression. MISRA-C++ Rule 6-2-1 (required): Assignment operators shall not be used in subexpressions.This rule is also covered by MISRA.ASSIGN.COND. RationaleAssignments used in a sub-expression add an additional side effect to that of the full expression, potentially resulting in a value inconsistent with developer expectations. In addition, this helps to avoid getting = and == confused. Examplex = y; x = y = z; // Non-compliant if ( x != 0 ) // Compliant { foo ( ); } bool b1 = x != y; // Compliant bool b2; b2 = x != y; // Compliant if ( ( x = y ) != 0 ) // Non-compliant { foo ( ); } if ( x = y ) // Non-compliant { foo ( ); } if ( int16_t i = foo ( ) ) // Compliant { } |