MISRA Discussion Forums
Rule 12.2 and "nested assignment statements" - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA-C:2004 Exemplar Suite (https://forum.misra.org.uk/forumdisplay.php?fid=116)
+--- Thread: Rule 12.2 and "nested assignment statements" (/showthread.php?tid=514)



Rule 12.2 and "nested assignment statements" - pkruk - 14-05-2008

Example from mc2_1203.c:
Code:
mc2_1203_x = sizeof ( mc2_1203_a = 1234U );

Is this code also a violation of rule 12.2 "nested assignment statements"?


Re: Rule 12.2 and "nested assignment statements" - misra-c - 21-05-2008

Code:
mc2_1203_x = sizeof ( mc2_1203_a = 1234U );
This is not a violation of Rule 12.2.
This is a violation of Rule 12.3.

mc2_1203_a = 1234U is not executed, so is not an assignment statement.