aboutsummaryrefslogtreecommitdiff
path: root/docs/coding_conventions_c.md
diff options
context:
space:
mode:
authorKonstantin Đorđević <vomindoraan@gmail.com>2020-04-07 06:14:08 +0200
committerGitHub <noreply@github.com>2020-04-07 14:14:08 +1000
commitf4b67cde8ae24fdaac70071f793f5c8d0010d959 (patch)
tree0688288ed1f65602ed8508e13cf3ec89d5677453 /docs/coding_conventions_c.md
parent0a643be39eb710649560f80c6ce0bc32576813fd (diff)
downloadqmk_firmware-f4b67cde8ae24fdaac70071f793f5c8d0010d959.tar.gz
qmk_firmware-f4b67cde8ae24fdaac70071f793f5c8d0010d959.zip
Update C coding conventions to match .clang-format config for i… (#8717)
* Update C coding conventions to match current .clang-format config for indenting PP directives * Make indenting guideline clearer
Diffstat (limited to 'docs/coding_conventions_c.md')
-rw-r--r--docs/coding_conventions_c.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/coding_conventions_c.md b/docs/coding_conventions_c.md
index 16e28b288..f4e359611 100644
--- a/docs/coding_conventions_c.md
+++ b/docs/coding_conventions_c.md
@@ -20,11 +20,11 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely
20* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)` 20* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)`
21 * If you are not sure which to prefer use the `#if defined(DEFINED)` form. 21 * If you are not sure which to prefer use the `#if defined(DEFINED)` form.
22 * Do not change existing code from one style to the other, except when moving to a multiple condition `#if`. 22 * Do not change existing code from one style to the other, except when moving to a multiple condition `#if`.
23 * Do not put whitespace between `#` and `if`. 23* When deciding how (or if) to indent preprocessor directives, keep these points in mind:
24 * When deciding how (or if) to indent directives keep these points in mind: 24 * Readability is more important than consistency.
25 * Readability is more important than consistency. 25 * Follow the file's existing style. If the file is mixed, follow the style that makes sense for the section you are modifying.
26 * Follow the file's existing style. If the file is mixed follow the style that makes sense for the section you are modifying. 26 * When indenting, keep the hash at the start of the line and add whitespace between `#` and `if`, starting with 4 spaces after the `#`.
27 * When choosing to indent you can follow the indention level of the surrounding C code, or preprocessor directives can have their own indent level. Choose the style that best communicates the intent of your code. 27 * You can follow the indention level of the surrounding C code, or preprocessor directives can have their own indentation levels. Choose the style that best communicates the intent of your code.
28 28
29Here is an example for easy reference: 29Here is an example for easy reference:
30 30