[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-current
Subject:    NULL vs 0 vs 0L bikeshed time
From:       Mark Murray <mark () grondar ! org>
Date:       2004-02-29 15:46:35
Message-ID: 200402291546.i1TFkZ0w070591 () grimreaper ! grondar ! org
[Download RAW message or body]

Hi

1) Please restrain the need to bikeshed this one to death. I am
   sympathetic to technical arguments, but compulsive noise over
   such issues is annoying.

2) Please separate style disussion from technical discussion.

I'd like to commit the following patch. It makes sure that for C
and the kernel, NULL is a ((void *)0), and for C++, NULL is either
(0L) or 0, with __LP64__ used to define the difference.

The intent is to catch use of NULL where 0 or (0L) should be used.
It generates extra warnings (I promise to fix these).

Comments?

WARNING! Cut+Paste munging!

Index: _null.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/_null.h,v
retrieving revision 1.5
diff -u -d -r1.5 _null.h
diff -u -d -r1.5 _null.h
--- _null.h     26 Dec 2003 06:11:43 -0000      1.5
+++ _null.h     26 Dec 2003 10:36:52 -0000
@@ -28,14 +28,14 @@

 #ifndef NULL

-#ifdef _KERNEL
-#define        NULL    (void *)0
+#if defined(_KERNEL) || !defined(__cplusplus)
+#define        NULL    ((void *)0)
 #else
 #if defined(__LP64__)
-#define        NULL    0L
+#define        NULL    (0L)
 #else
 #define        NULL    0
-#endif
-#endif /* _KERNEL */
+#endif /* __LP64__ */
+#endif /* _KERNEL || !__cplusplus */

 #endif

M
--
Mark Murray
iumop ap!sdn w,I idlaH
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic