Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/misc Amend variable initialization in the declarations...



details:   https://anonhg.NetBSD.org/src/rev/72b449a0e1e0
branches:  trunk
changeset: 341189:72b449a0e1e0
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 24 15:46:09 2015 +0000

description:
Amend variable initialization in the declarations comment.

diffstat:

 share/misc/style |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 89a2e9df4a9d -r 72b449a0e1e0 share/misc/style
--- a/share/misc/style  Sat Oct 24 14:30:28 2015 +0000
+++ b/share/misc/style  Sat Oct 24 15:46:09 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.51 2013/03/08 16:50:02 christos Exp $ */
+/* $NetBSD: style,v 1.52 2015/10/24 15:46:09 christos Exp $ */
 
 /*
  * The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.51 2013/03/08 16:50:02 christos Exp $");
+__RCSID("$NetBSD: style,v 1.52 2015/10/24 15:46:09 christos Exp $");
 
 /*
  * VERY important single-line comments look like this.
@@ -339,7 +339,10 @@
         * Function prototypes should go in the include file "extern.h".
         * If a line overflows reuse the type keyword.
         *
-        * DO NOT initialize variables in the declarations.
+        * Avoid initializing variables in the declarations; move
+        * declarations next to their first use, and initialize
+        * opportunistically. This avoids over-initialization and
+        * accidental bugs caused by declaration reordering.
         */
        extern u_char one;
        extern char two;



Home | Main Index | Thread Index | Old Index