summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2020-02-03 22:33:05 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2020-02-03 22:33:05 +0000
commitaed93ef7c19ee3d52d1247bbf928039726808481 (patch)
treeccb9525b45d9ad2bef1db7d9faabf881a884c3c4 /share
parent611dc6d7e0fa40b56c1ed813e3d10ff60f2e9115 (diff)
1. To avoid confusion, when showing a function definition, call it
a definition rather than a declaration, even though every definition is of course also a declaration. 2. Prototype functions used from other files in include files; stop restricting that advice to kernel code. 3. Drop some duplicate content. OK jca@
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/style.911
1 files changed, 4 insertions, 7 deletions
diff --git a/share/man/man9/style.9 b/share/man/man9/style.9
index d535112afdf..93599b2ebf0 100644
--- a/share/man/man9/style.9
+++ b/share/man/man9/style.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: style.9,v 1.74 2020/02/02 03:08:37 schwarze Exp $
+.\" $OpenBSD: style.9,v 1.75 2020/02/03 22:33:04 schwarze Exp $
.\"
-.Dd $Mdocdate: February 2 2020 $
+.Dd $Mdocdate: February 3 2020 $
.Dt STYLE 9
.Os
.Sh NAME
@@ -111,7 +111,7 @@ In userland, functions local to one source module should be declared
This should not be done in kernel land since it makes it impossible
to use the kernel debugger.
.Pp
-Functions used from other parts of the kernel are prototyped in the
+Functions used from other files are prototyped in the
relevant include file.
.Pp
Functions that are used locally in more than one module go into a
@@ -380,9 +380,6 @@ function(int a1, int a2, float fl, int a4)
.Pp
When declaring variables in functions, declare them sorted by size (largest to
smallest), then in alphabetical order; multiple ones per line are okay.
-Old style function declarations should be avoided.
-ANSI style function declarations should go in an include file such as
-.Dq Pa extern.h .
If a line overflows, reuse the type keyword.
.Pp
Be careful not to obfuscate the code by initializing variables in
@@ -519,7 +516,7 @@ if ((six = (int *)overflow()) == NULL)
return eight;
.Ed
.Pp
-Always use ANSI function declarations.
+Always use ANSI function definitions.
Long parameter lists are wrapped with a normal four space indent.
.Pp
Variable numbers of arguments should look like this: