MISRA Discussion Forums
Multiple local initialsaions in a single line - 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 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.9 Initialisation (https://forum.misra.org.uk/forumdisplay.php?fid=36)
+---- Thread: Multiple local initialsaions in a single line (/showthread.php?tid=849)



Multiple local initialsaions in a single line - alon - 20-09-2011

Hello

dose a line of the form

Code:
int i=0,j=0,k,l;
considered a misuse of the comma operator.
meaning, the line is considered as composed of multiple statements in a single line.
if so then what about, just plain

Code:
int i,jk;

Thanks

-Alon


Re: Multiple local initialsaions in a single line - misra-c - 21-09-2011

In an list of declarators, the comma is being used as a separator rather than an operator. There are no comma operators in the examples given and therefore no violation of Rule 12.10.