diff options
Diffstat (limited to 'CONTRIBUTING.md')
| -rw-r--r-- | CONTRIBUTING.md | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb1067c92..302afe216 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md | |||
| @@ -28,23 +28,23 @@ Follow the indentation/whitespace style shown below. Do not use tabs, use 4-spac | |||
| 28 | namespace Example { | 28 | namespace Example { |
| 29 | 29 | ||
| 30 | // Namespace contents are not indented | 30 | // Namespace contents are not indented |
| 31 | 31 | ||
| 32 | // Declare globals at the top | 32 | // Declare globals at the top |
| 33 | int g_foo = 0; | 33 | int g_foo = 0; |
| 34 | char* g_some_pointer; // Notice the position of the * | 34 | char* g_some_pointer; // Notice the position of the * |
| 35 | 35 | ||
| 36 | enum SomeEnum { | 36 | enum SomeEnum { |
| 37 | COLOR_RED, | 37 | COLOR_RED, |
| 38 | COLOR_GREEN, | 38 | COLOR_GREEN, |
| 39 | COLOR_BLUE | 39 | COLOR_BLUE |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | struct Position { | 42 | struct Position { |
| 43 | int x, y; | 43 | int x, y; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | // Use "typename" rather than "class" here, just to be consistent | 46 | // Use "typename" rather than "class" here, just to be consistent |
| 47 | template | 47 | template |
| 48 | void FooBar() { | 48 | void FooBar() { |
| 49 | int some_array[] = { | 49 | int some_array[] = { |
| 50 | 5, | 50 | 5, |
| @@ -52,29 +52,29 @@ void FooBar() { | |||
| 52 | 7, | 52 | 7, |
| 53 | 42 | 53 | 42 |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | if (note == the_space_after_the_if) { | 56 | if (note == the_space_after_the_if) { |
| 57 | CallAfunction(); | 57 | CallAfunction(); |
| 58 | } else { | 58 | } else { |
| 59 | // Use a space after the // when commenting | 59 | // Use a space after the // when commenting |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | // Comment directly above code when possible | 62 | // Comment directly above code when possible |
| 63 | if (some_condition) single_statement(); | 63 | if (some_condition) single_statement(); |
| 64 | 64 | ||
| 65 | // Place a single space after the for loop semicolons | 65 | // Place a single space after the for loop semicolons |
| 66 | for (int i = 0; i != 25; ++i) { | 66 | for (int i = 0; i != 25; ++i) { |
| 67 | // This is how we write loops | 67 | // This is how we write loops |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | DoStuff(this, function, call, takes, up, multiple, | 70 | DoStuff(this, function, call, takes, up, multiple, |
| 71 | lines, like, this); | 71 | lines, like, this); |
| 72 | 72 | ||
| 73 | if (this || condition_takes_up_multiple && | 73 | if (this || condition_takes_up_multiple && |
| 74 | lines && like && this || everything || | 74 | lines && like && this || everything || |
| 75 | alright || then) { | 75 | alright || then) { |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | switch (var) { | 78 | switch (var) { |
| 79 | // No indentation for case label | 79 | // No indentation for case label |
| 80 | case 1: { | 80 | case 1: { |
| @@ -85,18 +85,18 @@ void FooBar() { | |||
| 85 | case 3: | 85 | case 3: |
| 86 | DoSomething(var); | 86 | DoSomething(var); |
| 87 | return; | 87 | return; |
| 88 | 88 | ||
| 89 | default: | 89 | default: |
| 90 | // Yes, even break for the last case | 90 | // Yes, even break for the last case |
| 91 | break; | 91 | break; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | std::vector | 94 | std::vector |
| 95 | you_can_declare, | 95 | you_can_declare, |
| 96 | a_few, | 96 | a_few, |
| 97 | variables, | 97 | variables, |
| 98 | like_this; | 98 | like_this; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | } | 101 | } |
| 102 | ``` | 102 | ``` |