20-05-2008, 05:09 PM
Note, use of the comma operator is banned under Rule 12.10.
If no reliance is being placed on C's operator precedence then the loop should be written:
Rule 12.1 recognises that it would clutter code considerably if every expression were parenthesised. It leaves the matter of what constitutes "too much" clutter up to individual or organisational choice.
If no reliance is being placed on C's operator precedence then the loop should be written:
Code:
for ((i = 0), (j = 0); i < 10; i++, j++) {}
Rule 12.1 recognises that it would clutter code considerably if every expression were parenthesised. It leaves the matter of what constitutes "too much" clutter up to individual or organisational choice.
Posted by and on behalf of the MISRA C Working Group