From 8432514c5fd0be05a8d76ce536610c547658af89 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 11 Feb 2017 16:48:29 +0100 Subject: DOCS/contribute.md: adjust coding style for if/else bracing --- DOCS/contribute.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'DOCS') diff --git a/DOCS/contribute.md b/DOCS/contribute.md index 9fc9d8d8bc..994e2040c1 100644 --- a/DOCS/contribute.md +++ b/DOCS/contribute.md @@ -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 -- cgit v1.2.3