Date: Mon, 1 Mar 2004 08:15:57 -0500 (EST) From: Thomas David Rivers <rivers@dignus.com> To: current@freebsd.org, mark@grondar.org Subject: Re: NULL vs 0 vs 0L bikeshed time Message-ID: <200403011315.i21DFvC95798@lakes.dignus.com> In-Reply-To: <200402291546.i1TFkZ0w070591@grimreaper.grondar.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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). > I believe that _may_ be backwards; the C and C++ standards speak to this, and both of them have slightly different requirements. The C standard discuss the NULL constant, implying it is simply a zero (not necessarily cast to a pointer.) But - I believe (and I need to check on this) that the C++ standard requires the NULL constant to be a pointer type (so various conversions work.) So - before doing this; it might be nice to review the various standards to see if it's applicable. - Dave Rivers - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe programming tools at http://www.dignus.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403011315.i21DFvC95798>