summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-11-01 16:20:31 +0000
committerrwatson <rwatson@FreeBSD.org>2002-11-01 16:20:31 +0000
commitc60e6be0f44c52b8392d130a0da56a062ce5449c (patch)
tree7ca8cf2207bd4927ab68262f5e3cbde3e4cb8d6a /share
parente0f89bf346d7a562b29d9564d201296b0bedf0da (diff)
downloadFreeBSD-src-c60e6be0f44c52b8392d130a0da56a062ce5449c.zip
FreeBSD-src-c60e6be0f44c52b8392d130a0da56a062ce5449c.tar.gz
Further clarifications of the #ifdef/#if/#elif/#endif style information,
largely submitted by bde. Return our exemption of the #ifdef lint comments since the exemption is intended to handle a particularly common current case without mandating change. Improve language and spelling, and slightly clarify the notions associated specifically with #elif. Obtained from: bde
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/style.929
1 files changed, 16 insertions, 13 deletions
diff --git a/share/man/man9/style.9 b/share/man/man9/style.9
index e5e2061..d669b3b 100644
--- a/share/man/man9/style.9
+++ b/share/man/man9/style.9
@@ -82,7 +82,7 @@ in front of foreign VCS IDs if the file is renamed.
#if 0
#ifndef lint
static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95";
-#endif /* !lint */
+#endif /* not lint */
#endif
#include <sys/cdefs.h>
@@ -180,7 +180,7 @@ for pretty-printers and editors.
} while (0)
.Ed
.Pp
-When code blocks are conditionally defined using
+When code is conditionally compiled using
.Ic #ifdef
or
.Ic #if ,
@@ -188,34 +188,37 @@ a comment may be added following the matching
.Ic #endif
or
.Ic #else
-to permit the reader to easily discern where conditionally defined code
+to permit the reader to easily discern where conditionally compiled code
regions end.
This comment should be used only for (subjectively) long regions, regions
greater than 20 lines, or where a series of nested
.Ic #ifdef 's
may be confusing to the reader.
-Exceptions may be made for cases where code is contionally undefined for
-the purposes of lint, even though the undefined region may be small.
-The comment shall be seperated from the
+Exceptions may be made for cases where code is conditionally not compiled for
+the purposes of lint, even though the uncompiled region may be small.
+The comment should be separated from the
.Ic #endif
or
.Ic #else
by a single space.
-For short conditionally defined regions, a closing comment should not be
+For short conditionally compiled regions, a closing comment should not be
used.
.Pp
The comment for
.Ic #endif
-should match the expression used in
+should match the expression used in the corresponding
.Ic #if
or
.Ic #ifdef .
The comment for
.Ic #else
-should be the inverse of the expression used in the previous
+and
+.Ic #elif
+should match the inverse of the expression(s) used in the preceding
.Ic #if
-or
-.Ic #elsif .
+and/or
+.Ic #elif
+statements.
In the comments, the subexpression
.Dq Li defined(FOO)
is abbreviated as
@@ -230,13 +233,13 @@ is treated as
#endif
#ifdef COMPAT_43
-/* A long block here, or other conditional code. */
+/* A large region here, or other conditional code. */
#else /* !COMPAT_43 */
/* Or here. */
#endif /* COMPAT_43 */
#ifndef COMPAT_43
-/* Yet another long block here, or other conditional code. */
+/* Yet another large region here, or other conditional code. */
#else /* COMPAT_43 */
/* Or here. */
#endif /* !COMPAT_43*/
OpenPOWER on IntegriCloud