Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 6-2-1 Assignment operators shall not be used in subexpressions
#1
Hello.

Why are the following MISRA Example compliant?
Is not a sub-expression?
Code:
if ( int16_t i = foo ( ) ) // Compliant
{
}

It looks like the following, but the following are non-compliant.
What are the differences?
Code:
if ( x = y ) // Non-compliant
{
 foo ( );
}
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)