Signed-off-by: Leila Muhtasib <muhtasib@gmail.com> --- Does the below more accruately represent the coding guidelines? I can modify it, if it doesn't.
Thanks, Leila
Documentation/CodingGuidelines | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
Show changes to Documentation/CodingGuidelines +20 −3
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 4557711..ea90521 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -117,9 +117,26 @@ For C programs: is frowned upon. A gray area is when the statement extends over a few lines, and/or you have a lengthy comment atop of - it. Also, like in the Linux kernel, if there is a long list - of "else if" statements, it can make sense to add braces to - single line blocks. + it. Also, like in the Linux kernel, if one of the + "if/else if/else" chain has a multiple statement block, use {} + even for a single statement block in that chain. And "else" + should come on the same line as the closing "}" of its "if" block. + + //correct + if (bla) { + x = 1; + ... + } else { + x = 2; + } + + //incorrect + if (bla) { + x = 1; + ... + } + else + x = 2; - We try to avoid assignments inside if().
-- 1.7.7.5 (Apple Git-26)