Skip to content

Commit d2614e5

Browse files
committed
docs: Split up C style from generic style in CONTRIBUTING.md
Signed-off-by: Mintsuki <mintsuki@protonmail.com>
1 parent 150c714 commit d2614e5

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

CONTRIBUTING.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,25 @@ with no extensions must be used.
4848

4949
## Style
5050

51-
The project follows a relatively standard C coding style. It boils down to:
51+
### Generic style
5252

53+
- Use British spelling.
5354
- No hard tabs. Spaces for indentation and alignment. 4-space per indentation level.
5455
- Always avoid vertical alignment to minimise vertical blast radius on changes.
56+
- Comments are sparse: explain a non-obvious *why*, never restate the *what*. Don't narrate;
57+
avoid useless comments.
58+
- Stick to ASCII: avoid em-dashes and other non-ASCII characters in code, comments, commit
59+
messages, and documentation, unless the non-ASCII character is essential to the work.
60+
- Do not add per-file license headers.
61+
- Do not edit vendored/fetched/generated files (i.e. anything in `3RDPARTY.md`, or not in
62+
`git ls-files`).
63+
- As a catch-all, match the surrounding code: indentation, braces, naming, idiom. Mirror the
64+
conventions used by the file you edit.
65+
66+
### C language specific style
67+
68+
The project follows a relatively standard C coding style. It boils down to:
69+
5570
- Snake-case for most identifiers.
5671
- Uppercase snake-case for macros.
5772
- No pointless `typedef`s, especially for `struct`s. Always use the full `struct name var;`
@@ -98,15 +113,8 @@ The project follows a relatively standard C coding style. It boils down to:
98113
And, as shown, all cases should be curly braced blocks.
99114
- **Never** do things such as `if()`, `while()`, ... - **Always** put a space between
100115
keywords (i.e. not functions/function pointers) and parentheses.
101-
- Comments are sparse: explain a non-obvious *why*, never restate the *what*. Don't narrate;
102-
avoid useless comments.
103-
- Stick to ASCII: avoid em-dashes and other non-ASCII characters in code, comments, commit
104-
messages, and documentation, unless the non-ASCII character is essential to the work.
105-
- Do not add per-file license headers.
106-
- Do not edit vendored/fetched/generated files (i.e. anything in `3RDPARTY.md`, or not in
107-
`git ls-files`).
108-
- As a catch-all, match the surrounding code: indentation, braces, naming, idiom. Mirror the
109-
conventions used by the file you edit.
116+
117+
### Final style remarks
110118

111119
As with anything, there are always exceptions to these style rules, under given contexts.
112120

0 commit comments

Comments
 (0)