Difference between revisions of "Code Formatting Conventions"
Jump to navigation
Jump to search
(Update fallthrough comment in switch example) |
(Update convention for empty loops as discussed on -devel) |
||
Line 67: | Line 67: | ||
</source> | </source> | ||
''' | '''Mandatory ''{}'' for empty ''for''/''while'' loops''' | ||
<source lang="cpp"> | <source lang="cpp"> | ||
while (i < length - 1 && array[++i] != item) ; // | while (i < length - 1 && array[++i] != item); // bad | ||
while (i < length - 1 && array[++i] != item) {} // good | |||
while (i < length - 1 && array[++i] != item) | |||
</source> | </source> | ||