Edit class open parenthensis and switch statement

master
Petr Stefan 9 years ago
parent 8116837afa
commit 86afb503b8

@ -48,17 +48,17 @@ if (x == 5) {
}
```
* For and while cycles: basically same rules as for if condition.
* Switch: again basics are the same as for if condition. Case statements should be indented with tab and case body with 2 tabs.
* Switch: again basics are the same as for if condition. Case statements should not be indented and case body should be intended with 1 tab.
```
switch (switched) {
case 0: // tab indent
... // 2 tabs indent
break;
case 1:
...
break;
default:
exit(1);
case 0: // no tab indent
... // 1 tab indent
break;
case 1:
...
break;
default:
exit(1);
}
```
* Pointers and references: no spaces between period or arrow in accessing type member. No spaces after asterisk or ampersand. In declaration of pointer or reference format should be that asterisk or ampersand is adjacent to name of the variable not type.
@ -85,15 +85,14 @@ if (i > 10 &&
```
* Return values should not be generally wrapped with parentheses, only if needed.
* Preprocessor directives start with `#` and always should start at the beginning of the line.
* Classes: sections aka. public, protected, private should have same indentation as the class start itself. Opening parenthesis of class should be on the new line.
* Classes: sections aka. public, protected, private should have same indentation as the class start itself. Opening parenthesis of class should be on the same line as class name.
```
class my_class
{
class my_class {
public:
void class_function();
private:
int class_member_;
}
};
```
* Operators: around all binary operators there always should be one space.
```

Loading…
Cancel
Save