unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] STYLE: document some rules about variable declarations
@ 2016-02-13 17:11 David Bremner
  2016-02-13 17:11 ` [PATCH 2/2] STYLE: suggest long names David Bremner
  2016-03-05  0:49 ` [PATCH 1/2] STYLE: document some rules about variable declarations David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: David Bremner @ 2016-02-13 17:11 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] STYLE: suggest long names
  2016-02-13 17:11 [PATCH 1/2] STYLE: document some rules about variable declarations David Bremner
@ 2016-02-13 17:11 ` David Bremner
  2016-03-05  0:49 ` [PATCH 1/2] STYLE: document some rules about variable declarations David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2016-02-13 17:11 UTC (permalink / raw)
  To: notmuch

Hopefully the exceptions are common sense.
---
 devel/STYLE | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/devel/STYLE b/devel/STYLE
index b22d8d3..da65312 100644
--- a/devel/STYLE
+++ b/devel/STYLE
@@ -71,6 +71,10 @@ Naming
 * Use lowercase_with_underscores for function, variable, and type
   names.
 
+* Except for variables with extremely small scope, and perhaps loop
+  indices, when naming variables and functions, err on the side of
+  verbosity.
+
 * All structs should be typedef'd to a name ending with _t.  If the
   struct has a tag, it should be the same as the typedef name, minus
   the trailing _t.
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] STYLE: document some rules about variable declarations
  2016-02-13 17:11 [PATCH 1/2] STYLE: document some rules about variable declarations David Bremner
  2016-02-13 17:11 ` [PATCH 2/2] STYLE: suggest long names David Bremner
@ 2016-03-05  0:49 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2016-03-05  0:49 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> 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.

pushed both of these style guide updates

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-05  0:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13 17:11 [PATCH 1/2] STYLE: document some rules about variable declarations David Bremner
2016-02-13 17:11 ` [PATCH 2/2] STYLE: suggest long names David Bremner
2016-03-05  0:49 ` [PATCH 1/2] STYLE: document some rules about variable declarations David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).