From owner-cvs-gnu Fri Sep 19 10:27:36 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id KAA25820 for cvs-gnu-outgoing; Fri, 19 Sep 1997 10:27:36 -0700 (PDT) Received: from precipice.shockwave.com (precipice.shockwave.com [207.105.15.229]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id KAA25813; Fri, 19 Sep 1997 10:27:33 -0700 (PDT) Received: from shockwave.com (localhost [127.0.0.1]) by precipice.shockwave.com (8.8.6/8.7.3) with ESMTP id KAA16309; Fri, 19 Sep 1997 10:25:25 -0700 (PDT) Message-Id: <199709191725.KAA16309@precipice.shockwave.com> To: Bruce Evans cc: jonny@coppe.ufrj.br, phk@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-gnu@FreeBSD.ORG Subject: Re: cvs commit: src/gnu/usr.bin/as/config atof-ieee.c src/gnu/usr.bin/ld/rtld rtld.c src/gnu/usr.bin/man/man man.c In-reply-to: Your message of "Fri, 19 Sep 1997 23:40:16 +1000." <199709191340.XAA17971@godzilla.zeta.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 19 Sep 1997 10:25:25 -0700 From: Paul Traina Sender: owner-cvs-gnu@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > >#define quoting(Poul-Henning Kamp) > >// Many places in the code NULL is used in integer context, where > >// plain 0 should be used. This happens to work because we #define > >// NULL to 0, but is stylistically wrong and can cause problems > >// for people trying to port bits of code to other environments. > > > >Is there any problem in defining NULL to ((void *)0) ? > > Yes, it would require fixing all the code that uses NULL in integer > context, and would hide the opposite problem of misuse of NULL in > non-integer contexts, e.g., > > void foo(bar) void *bar; { ... } > ... > foo(NULL); /* no prototype in scope */ > > `lint -p' should warn that the arg is inconsistent, but can't do so if > NULL is ((void *)0). Could you please explain that more clearly? I see a perfectly good implied prototype in scope, and the fact of the matter is that I should not be forced to typecast NULL into a particular pointer type, ever. Null is well defined as a "pointer of some type, with a value of 0" To me, #define NULL (void *)0 is the ultimate protection against the misuse of NULL. Paul