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
This commit is contained in:
parent
0a643be39e
commit
f4b67cde8a
@ -20,11 +20,11 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely
|
||||
* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)`
|
||||
* If you are not sure which to prefer use the `#if defined(DEFINED)` form.
|
||||
* Do not change existing code from one style to the other, except when moving to a multiple condition `#if`.
|
||||
* Do not put whitespace between `#` and `if`.
|
||||
* When deciding how (or if) to indent directives keep these points in mind:
|
||||
* When deciding how (or if) to indent preprocessor directives, keep these points in mind:
|
||||
* Readability is more important than consistency.
|
||||
* Follow the file's existing style. If the file is mixed follow the style that makes sense for the section you are modifying.
|
||||
* 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.
|
||||
* Follow the file's existing style. If the file is mixed, follow the style that makes sense for the section you are modifying.
|
||||
* When indenting, keep the hash at the start of the line and add whitespace between `#` and `if`, starting with 4 spaces after the `#`.
|
||||
* 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.
|
||||
|
||||
Here is an example for easy reference:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user