Received: by 10.213.65.68 with SMTP id h4csp1564487imn; Thu, 15 Mar 2018 03:26:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELviDQQ6jcNWUwzBT5vGjNcsyVVjPrXq9mUgEgQep/2lKSeMIWwezS4v3t/mvQteXEeHO0FY X-Received: by 10.99.109.203 with SMTP id i194mr6491075pgc.314.1521109602826; Thu, 15 Mar 2018 03:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521109602; cv=none; d=google.com; s=arc-20160816; b=uzCpZz3ehLGZ61RWWQMmcy7Z65qQss49eeYOsfvW0HzTXcwiokbbhm9wuvOAhJQZH9 EDuiiozjR5/EqWCpnbgJZmX0j/DRmwhl1Hcs5ccOLJ2ENWxOpKwD67L2kkWQEjdJbdG/ zFpz+EJ4XAYl1OJq4wP8H8YpQTQ+LrJyohS014rKezpTOIUoLZXM95JEQObV9DhSsQHr sNqqKDFt5/n2ODxWIu6+ykagdgo4vfaAHT3fAUaJUBKxLjZjJmot4kvxGXFDx0Xv39C/ 2nmeuxCHAtNfdyOskfJS9IPWBB1XutNHdaqov6V9MryWEeFhUkV4eEmPXpy8BGO+lwWw jAqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=KTuhSycAMr6T4zWTyEcCD6eTdds5wPMffdMCERo8R/M=; b=OeATYu8aNkFrIZyIS65YreVc+pFmrQ/nk/VIkmUlrb3sxN6KwNtza4u9EFrzjPmXlH QbygxhHfXSkDpy5dCkIV1Gsqgbg0H9rjoa4m0ezf8Zgd5j9j6uH1thiBDJXO31OePAzb 5pmrLM4kNN4dKEBVmG1cXeiXLfjfSqZngjnUjOG72QQ30bppwjZYmV/fXLvnfmXc1pUB kmtrU6YYxTcwmlyBkYvDcgqpfTp5db4l3uRs6l5Bv6nx0NlZLogNvLQIzkDcBcZD3gBN U12p3Zy6q3xNw5U0ewzv/J7aMbbMJDmk9Q+eKUhXFlVvupwDv4zJptSjlxnkGJ9+7kXC ryuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si3629372pfi.212.2018.03.15.03.26.28; Thu, 15 Mar 2018 03:26:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752078AbeCOKZR (ORCPT + 99 others); Thu, 15 Mar 2018 06:25:17 -0400 Received: from mga14.intel.com ([192.55.52.115]:17455 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeCOKZP (ORCPT ); Thu, 15 Mar 2018 06:25:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Mar 2018 03:25:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,310,1517904000"; d="scan'208";a="38196789" Received: from jnikula-mobl2.fi.intel.com (HELO localhost) ([10.237.72.62]) by fmsmga001.fm.intel.com with ESMTP; 15 Mar 2018 03:25:14 -0700 From: Jani Nikula To: Gary R Hook , linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, corbet@lwn.net Subject: Re: [PATCH] Documentation/CodingStyle: Add an example for braces In-Reply-To: <152106609844.18780.6843553697430932588.stgit@taos> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <152106609844.18780.6843553697430932588.stgit@taos> Date: Thu, 15 Mar 2018 12:26:09 +0200 Message-ID: <87zi39ljni.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Mar 2018, Gary R Hook wrote: > Add another example of required braces when using a compound statement in > a loop. > > Signed-off-by: Gary R Hook > --- > 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: Personally, I'd not limit this to loops. if (condition) { if (another_condition) action(); } You could argue the existing rule already covers these cases by excluding selection and iteration statements from the "single statement" in "Do not unnecessarily use braces where a single statement will do." BR, Jani. > + > +.. 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 -- Jani Nikula, Intel Open Source Technology Center