Edit class open parenthensis and switch statement

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

@ -48,16 +48,16 @@ if (x == 5) {
} }
``` ```
* For and while cycles: basically same rules as for if condition. * 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) { switch (switched) {
case 0: // tab indent case 0: // no tab indent
... // 2 tabs indent ... // 1 tab indent
break; break;
case 1: case 1:
... ...
break; break;
default: default:
exit(1); exit(1);
} }
``` ```
@ -85,15 +85,14 @@ if (i > 10 &&
``` ```
* Return values should not be generally wrapped with parentheses, only if needed. * 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. * 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: public:
void class_function(); void class_function();
private: private:
int class_member_; int class_member_;
} };
``` ```
* Operators: around all binary operators there always should be one space. * Operators: around all binary operators there always should be one space.
``` ```

Loading…
Cancel
Save