Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 1997 10:25:25 -0700
From:      Paul Traina <pst@shockwave.com>
To:        Bruce Evans <bde@zeta.org.au>
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 
Message-ID:  <199709191725.KAA16309@precipice.shockwave.com>
In-Reply-To: Your message of "Fri, 19 Sep 1997 23:40:16 %2B1000." <199709191340.XAA17971@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> >#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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709191725.KAA16309>