Mon Apr 17 00:37:04 2023 UTC ()
share/misc/style: Don't prescribe using "extern.h" for all prototypes.

That's very 80s.

No objection (or even response, amazingly enough) on tech-userlevel in
two weeks.


(dholland)
diff -r1.72 -r1.73 src/share/misc/style

cvs diff -r1.72 -r1.73 src/share/misc/style (expand / switch to unified diff)

--- src/share/misc/style 2023/04/15 12:22:37 1.72
+++ src/share/misc/style 2023/04/17 00:37:04 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: style,v 1.72 2023/04/15 12:22:37 rillig Exp $ */ 1/* $NetBSD: style,v 1.73 2023/04/17 00:37:04 dholland Exp $ */
2 2
3/* 3/*
4 * The revision control tag appears first, with a blank line after it. 4 * The revision control tag appears first, with a blank line after it.
5 * Copyright text appears after the revision control tag. 5 * Copyright text appears after the revision control tag.
6 */ 6 */
7 7
8/* 8/*
9 * The NetBSD source code style guide. 9 * The NetBSD source code style guide.
10 * (Previously known as KNF - Kernel Normal Form). 10 * (Previously known as KNF - Kernel Normal Form).
11 * 11 *
12 * from: @(#)style 1.12 (Berkeley) 3/18/94 12 * from: @(#)style 1.12 (Berkeley) 3/18/94
13 */ 13 */
14/* 14/*
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 */ 20 */
21 21
22/* 22/*
23 * Source code revision control identifiers appear after any copyright 23 * Source code revision control identifiers appear after any copyright
24 * text. Use the appropriate macros from <sys/cdefs.h>. Usually only one 24 * text. Use the appropriate macros from <sys/cdefs.h>. Usually only one
25 * source file per program contains a __COPYRIGHT() section. 25 * source file per program contains a __COPYRIGHT() section.
26 * Historic Berkeley code may also have an __SCCSID() section. 26 * Historic Berkeley code may also have an __SCCSID() section.
27 * Only one instance of each of these macros can occur in each file. 27 * Only one instance of each of these macros can occur in each file.
28 * Don't use newlines in the identifiers. 28 * Don't use newlines in the identifiers.
29 */ 29 */
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__COPYRIGHT("@(#) Copyright (c) 2008\ 31__COPYRIGHT("@(#) Copyright (c) 2008\
32 The NetBSD Foundation, inc. All rights reserved."); 32 The NetBSD Foundation, inc. All rights reserved.");
33__RCSID("$NetBSD: style,v 1.72 2023/04/15 12:22:37 rillig Exp $"); 33__RCSID("$NetBSD: style,v 1.73 2023/04/17 00:37:04 dholland Exp $");
34 34
35/* 35/*
36 * VERY important single-line comments look like this. 36 * VERY important single-line comments look like this.
37 */ 37 */
38 38
39/* Most single-line comments look like this. */ 39/* Most single-line comments look like this. */
40 40
41/* 41/*
42 * Multi-line comments look like this. Make them real sentences. Fill 42 * Multi-line comments look like this. Make them real sentences. Fill
43 * them so they look like real paragraphs. 43 * them so they look like real paragraphs.
44 */ 44 */
45 45
46/* 46/*
@@ -346,27 +346,28 @@ main(int argc, char *argv[]) @@ -346,27 +346,28 @@ main(int argc, char *argv[])
346} 346}
347 347
348/* 348/*
349 * The function type must be declared on a line by itself 349 * The function type must be declared on a line by itself
350 * preceding the function. 350 * preceding the function.
351 */ 351 */
352static char * 352static char *
353function(int a1, int a2, float fl, int a4) 353function(int a1, int a2, float fl, int a4)
354{ 354{
355 /* 355 /*
356 * When declaring variables in functions, multiple variables per line 356 * When declaring variables in functions, multiple variables per line
357 * are okay. If a line overflows reuse the type keyword. 357 * are okay. If a line overflows reuse the type keyword.
358 * 358 *
359 * Function prototypes should go in the include file "extern.h". 359 * Function prototypes and external data declarations should go in a
 360 * suitable include file.
360 * 361 *
361 * Avoid initializing variables in the declarations; move 362 * Avoid initializing variables in the declarations; move
362 * declarations next to their first use, and initialize 363 * declarations next to their first use, and initialize
363 * opportunistically. This avoids over-initialization and 364 * opportunistically. This avoids over-initialization and
364 * accidental bugs caused by declaration reordering. 365 * accidental bugs caused by declaration reordering.
365 */ 366 */
366 struct foo three, *four; 367 struct foo three, *four;
367 double five; 368 double five;
368 int *six, seven; 369 int *six, seven;
369 char *eight, *nine, ten, eleven, twelve, thirteen; 370 char *eight, *nine, ten, eleven, twelve, thirteen;
370 char fourteen, fifteen, sixteen; 371 char fourteen, fifteen, sixteen;
371 372
372 /* 373 /*