mirror of
https://github.com/mpv-player/mpv
synced 2025-02-07 07:31:48 +00:00
DOCS/contribute.md: adjust coding style for if/else bracing
This commit is contained in:
parent
8bc335e3db
commit
8432514c5f
@ -101,18 +101,16 @@ mpv uses C99 with K&R formatting, with some exceptions.
|
||||
do_something();
|
||||
}
|
||||
```
|
||||
- If the body of an if statement uses braces, the else branch should also
|
||||
use braces (and reverse).
|
||||
- If the if has an else branch, both branches should use braces, even if they're
|
||||
technically redundant.
|
||||
|
||||
Example:
|
||||
|
||||
```C
|
||||
if (a) {
|
||||
// do something
|
||||
something();
|
||||
something_else();
|
||||
} else {
|
||||
one_line();
|
||||
} else {
|
||||
one_other_line();
|
||||
}
|
||||
```
|
||||
- If an if condition spans multiple physical lines, then put the opening brace
|
||||
|
Loading…
Reference in New Issue
Block a user