1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

adds additional headings to Curly braces section

Adds proposed sub headings to Formatting Style > Curly Braces section
This commit is contained in:
Chris 2021-01-22 16:01:58 -08:00 committed by GitHub
parent 5e5748c99a
commit 7641bdcc91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,7 @@ Sometimes, for example, you may want other columns and line breaks so it looks l
Note2: The Astyle settings have been tested and will produce a nice result. Many files will be changed, mostly to the better but maybe not always, so use with care. Note2: The Astyle settings have been tested and will produce a nice result. Many files will be changed, mostly to the better but maybe not always, so use with care.
## Curly Braces ## Curly Braces
### Functions
Functions shall have the opening and closing braces at the beginning of the next line, and followed by a line break. Functions shall have the opening and closing braces at the beginning of the next line, and followed by a line break.
``` ```
int function(int x) int function(int x)
@ -38,9 +38,12 @@ int function(int x)
body of function body of function
} }
``` ```
### Non-function statement blocks
#### Opening braces
All non-function statement blocks (i.e. `if`, ` switch`, `for`, as well as any others) shall have the opening brace last on the same line, with the following statement on the next line. All non-function statement blocks (i.e. `if`, ` switch`, `for`, as well as any others) shall have the opening brace last on the same line, with the following statement on the next line.
#### Closing braces
Closing braces shall be but on the line after the last statement in the block. Closing braces shall be but on the line after the last statement in the block.
``` ```
if (x is true) { if (x is true) {