From: Gary R Hook <gary.hook@amd.com> To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, corbet@lwn.net Subject: [PATCH] Documentation/CodingStyle: Add an example for braces Date: Wed, 14 Mar 2018 17:21:38 -0500 [thread overview] Message-ID: <152106609844.18780.6843553697430932588.stgit@taos> (raw) Add another example of required braces when using a compound statement in a loop. Signed-off-by: Gary R Hook <gary.hook@amd.com> --- Documentation/process/coding-style.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index a20b44a40ec4..d98deb62c400 100644 --- a/Documentation/process/coding-style.rst +++ b/Documentation/process/coding-style.rst @@ -200,6 +200,15 @@ statement; in the latter case use braces in both branches: otherwise(); } +Also, use braces when a loop contains more than a single simple statement: + +.. code-block:: c + + while (condition) { + if (test) + do_something(); + } + 3.1) Spaces ***********
WARNING: multiple messages have this Message-ID (diff)
From: Gary R Hook <gary.hook@amd.com> To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, corbet@lwn.net Subject: [PATCH] Documentation/CodingStyle: Add an example for braces Date: Wed, 14 Mar 2018 17:21:38 -0500 [thread overview] Message-ID: <152106609844.18780.6843553697430932588.stgit@taos> (raw) Add another example of required braces when using a compound statement in a loop. Signed-off-by: Gary R Hook <gary.hook@amd.com> --- Documentation/process/coding-style.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index a20b44a40ec4..d98deb62c400 100644 --- a/Documentation/process/coding-style.rst +++ b/Documentation/process/coding-style.rst @@ -200,6 +200,15 @@ statement; in the latter case use braces in both branches: otherwise(); } +Also, use braces when a loop contains more than a single simple statement: + +.. code-block:: c + + while (condition) { + if (test) + do_something(); + } + 3.1) Spaces *********** -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2018-03-14 22:21 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-14 22:21 Gary R Hook [this message] 2018-03-14 22:21 ` [PATCH] Documentation/CodingStyle: Add an example for braces Gary R Hook 2018-03-15 10:26 ` Jani Nikula 2018-03-15 10:26 ` Jani Nikula 2018-03-15 19:54 ` Gary R Hook 2018-03-15 19:54 ` Gary R Hook
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=152106609844.18780.6843553697430932588.stgit@taos \ --to=gary.hook@amd.com \ --cc=corbet@lwn.net \ --cc=linux-doc@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.