summaryrefslogtreecommitdiffstats
path: root/share/man
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-07-17 12:32:18 +0000
committerbde <bde@FreeBSD.org>1996-07-17 12:32:18 +0000
commit227052690b2953ee7e3a0ff58e10749fb94fc1a6 (patch)
tree0e737683bb1fc991be7c2478aa13deddac291de7 /share/man
parent8c325c27d26c5177c6ff268e5ab101ca02858710 (diff)
downloadFreeBSD-src-227052690b2953ee7e3a0ff58e10749fb94fc1a6.zip
FreeBSD-src-227052690b2953ee7e3a0ff58e10749fb94fc1a6.tar.gz
Restored most of suggestion about using NULL, even though wollman
disagrees with it personally :-), and fixed the misleading parts.
Diffstat (limited to 'share/man')
-rw-r--r--share/man/man9/style.916
1 files changed, 12 insertions, 4 deletions
diff --git a/share/man/man9/style.9 b/share/man/man9/style.9
index 89976d6..e05a6f9 100644
--- a/share/man/man9/style.9
+++ b/share/man/man9/style.9
@@ -13,7 +13,7 @@ files in the FreeBSD source tree.
*
* @(#)style 1.14 (Berkeley) 4/28/95
*
- * $Id: style.9,v 1.7 1996/04/07 08:37:54 mpp Exp $
+ * $Id: style.9,v 1.8 1996/06/13 19:52:42 wollman Exp $
*
*/
@@ -278,8 +278,16 @@ the declarations. Use this feature only thoughtfully.
.Ed
.Pp
Casts and sizeof's are not followed by a space.
-Also, test pointers
-against NULL, i.e. use:
+.Pp
+NULL is the preferred null pointer constant. Use NULL instead of
+(type *)0 or (type *)NULL in contexts where the compiler knows the
+type, e.g., in assignments. Use (type *)NULL in other contexts,
+in particular for all function args. (Casting is essential for
+varadic args and is necessary for other args if the function prototype
+might not be in scope; since we pretend to support K&R compilers,
+most prototypes might not be in scope.)
+Test pointers
+against NULL, e.g., use:
.Bd -literal -offset 0i
(p = f()) == NULL
.Ed
@@ -309,7 +317,7 @@ or
don't roll your own!
.Bd -literal -offset 0i
if ((four = malloc(sizeof(struct foo))) == NULL)
- err(1, NULL);
+ err(1, (char *)NULL);
if ((six = (int *)overflow()) == NULL)
errx(1, "Number overflowed.");
return (eight);
OpenPOWER on IntegriCloud