Open main menu

Difference between revisions of "Code Formatting Conventions"

→‎Switch/Case constructs: enhanced to avoid ambiguity
(→‎Naming: Mention template types and non-member functions)
(→‎Switch/Case constructs: enhanced to avoid ambiguity)
Line 167: Line 167:
switch (cmd) {
switch (cmd) {
case kSomeCmd:
case kSomeCmd:
     someCmd();
     a = 1;
    func1();
    b = a + 1;
     // fall through
     // fall through
case kSomeVerySimilarCmd:
case kSomeVerySimilarCmd:
     someMoreCmd();
     someMoreCmd();
    a = 3;
     break;
     break;
case kSaveCmd:
case kSaveCmd:
Line 184: Line 187:
</syntaxhighlight>
</syntaxhighlight>
* Note the comment on whether fall through is intentional. Use exactly this and not some variation both for consistency and so that the compiler will see it and suppress potential warnings.
* Note the comment on whether fall through is intentional. Use exactly this and not some variation both for consistency and so that the compiler will see it and suppress potential warnings.


== Vertical space ==
== Vertical space ==