git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] CodingGuidelines: Added note about position of 'else' in C programs.

From
Leila Muhtasib <muhtasib@gmail.com>
Date
Jun 14, 2012, 01:42 UTC
Message-ID
<1339638163-33870-1-git-send-email-muhtasib@gmail.com>

During code review of some patches, it was noted that 'else' should appear on the same line as the closing '}' of its 'if' block.

Signed-off-by: Leila Muhtasib <muhtasib@gmail.com>
---
 Documentation/CodingGuidelines |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 4557711..99588f0 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -123,6 +123,9 @@ For C programs:
 
  - We try to avoid assignments inside if().
 
+ - "else" should be positioned on the same line as the closing
+   "}" of its "if" block.
+
  - Try to make your code understandable.  You may put comments
    in, but comments invariably tend to stale out when the code
    they were describing changes.  Often splitting a function
-- 
1.7.7.5 (Apple Git-26)
Message 1 of 1 in “CodingGuidelines: Added note about position of 'else' in C programs.”
  1. CodingGuidelines: Added note about position of 'else' in C programs.Leila Muhtasib, Jun 14, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.