23-04-2022, 03:47 PM
It is not possible to give a clear comment from the given example of code. In general the comma operator can be replaced by splitting up the expression.
For example:
If it is not possible to ammend the code, the advisory rule could be disapplied subject to appropriate justificatications.
For example:
Code:
X = ( A = B, 0 );
can be replaced by
A = B; X = 0;
and
while ( (A = B, A > 0) ) { .... }
can be replaced by
A = B;
while ( A > 0 { ... A = B; }
If it is not possible to ammend the code, the advisory rule could be disapplied subject to appropriate justificatications.
Posted by and on behalf of the MISRA C Working Group