From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1CE666DE0AF8 for ; Sat, 13 Feb 2016 09:11:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.307 X-Spam-Level: X-Spam-Status: No, score=-0.307 tagged_above=-999 required=5 tests=[AWL=0.244, RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TVJ8ETaEBGqV for ; Sat, 13 Feb 2016 09:11:25 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 60ED26DE0A9A for ; Sat, 13 Feb 2016 09:11:25 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.84) (envelope-from ) id 1aUdiV-0004K3-5I; Sat, 13 Feb 2016 12:10:43 -0500 Received: (nullmailer pid 9990 invoked by uid 1000); Sat, 13 Feb 2016 17:11:23 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 1/2] STYLE: document some rules about variable declarations Date: Sat, 13 Feb 2016 13:11:18 -0400 Message-Id: <1455383479-9946-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.6.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Feb 2016 17:11:27 -0000 No-one seemed opposed to C99 style loop variable declarations. The requirement to declare variables at the top of blocks is maybe a little more contested, but I believe it reflects the status quo. --- devel/STYLE | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/devel/STYLE b/devel/STYLE index 24bd548..b22d8d3 100644 --- a/devel/STYLE +++ b/devel/STYLE @@ -25,9 +25,7 @@ The following nonsense code demonstrates many aspects of the style: static some_type function (param_type param, param_type param) { - int i; - - for (i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { int j; j = i + 10; @@ -64,6 +62,9 @@ function (param_type param, param_type param) * Code lines should be less than 80 columns and comments should be wrapped at 70 columns. +* Variable declarations should be at the top of a block; C99 style + control variable declarations in for loops are also OK. + Naming ------ -- 2.6.4