From owner-freebsd-current@FreeBSD.ORG Sun Feb 29 07:50:20 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 82DA116A4CE for ; Sun, 29 Feb 2004 07:50:20 -0800 (PST) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CC5843D1D for ; Sun, 29 Feb 2004 07:50:17 -0800 (PST) (envelope-from mark@grondar.org) Received: from storm.FreeBSD.org.uk (Ugrondar@localhost [127.0.0.1]) by storm.FreeBSD.org.uk (8.12.10/8.12.10) with ESMTP id i1TFoFjV049590 for ; Sun, 29 Feb 2004 15:50:16 GMT (envelope-from mark@grondar.org) Received: (from Ugrondar@localhost)i1TFoFGI049589 for current@freebsd.org; Sun, 29 Feb 2004 15:50:15 GMT (envelope-from mark@grondar.org) X-Authentication-Warning: storm.FreeBSD.org.uk: Ugrondar set sender to mark@grondar.org using -f Received: from grondar.org (localhost [127.0.0.1])i1TFkZ0w070591 for ; Sun, 29 Feb 2004 15:46:36 GMT (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200402291546.i1TFkZ0w070591@grimreaper.grondar.org> To: current@freebsd.org Date: Sun, 29 Feb 2004 15:46:35 +0000 Sender: mark@grondar.org X-Spam-Score: 4 (****) FROM_NO_LOWER,MSGID_FROM_MTA_SHORT X-Scanned-By: MIMEDefang 2.39 X-Mailman-Approved-At: Mon, 01 Mar 2004 05:01:12 -0800 Subject: NULL vs 0 vs 0L bikeshed time X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Feb 2004 15:50:20 -0000 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