Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/misc C99: Suggest using narrow scopes for loop indices.
details: https://anonhg.NetBSD.org/src/rev/b253b998eb8f
branches: trunk
changeset: 372850:b253b998eb8f
user: jkoshy <jkoshy%NetBSD.org@localhost>
date: Fri Dec 30 17:02:31 2022 +0000
description:
C99: Suggest using narrow scopes for loop indices.
diffstat:
share/misc/style | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r d76e7ea0155b -r b253b998eb8f share/misc/style
--- a/share/misc/style Fri Dec 30 15:41:35 2022 +0000
+++ b/share/misc/style Fri Dec 30 17:02:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.65 2022/12/29 18:23:37 jkoshy Exp $ */
+/* $NetBSD: style,v 1.66 2022/12/30 17:02:31 jkoshy 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.65 2022/12/29 18:23:37 jkoshy Exp $");
+__RCSID("$NetBSD: style,v 1.66 2022/12/30 17:02:31 jkoshy Exp $");
/*
* VERY important single-line comments look like this.
@@ -259,9 +259,11 @@
*
* Braces around single-line bodies are optional; use discretion.
*
+ * Use narrow scopes for loop variables where possible.
+ *
* Forever loops are done with for's, not while's.
*/
- for (p = buf; *p != '\0'; ++p)
+ for (char *p = buf; *p != '\0'; ++p)
continue; /* Explicit no-op */
for (;;)
stmt;
Home |
Main Index |
Thread Index |
Old Index