[net.followup] f

ok@edai.UUCP (Richard O'Keefe) (03/12/84)

     Thanks to all those kind people who keep telling me (9 so far) that
Lint is entitled to complain about "inconsistent usage" of f's  argument
when in one place you call f(NULL) and in another call f(p) where p is
sometype *p;

     You have all pointed out that 0 is an int, and that only assignment
of 0 to a pointer variable is defined.  (Some of you  are  wrong  there,
comparison of a pointer with 0 is also defined; after doing p = 0, it is
not necessarily true that (int)p == 0, but it is true that !p.)

     My real mistake was that I hadn't realised that NULL was defined to
be 0.  I thought it was defined to be say (char*)0 and that the compiler
knew when a pointer constant was 0.  It isn't and it doesn't.

     Is there any good reason for not having a special constant  pointer
'null'  in C as there is in Pascal, which would be coercible to any type
of pointer?  Or rather, since there are machines such as the  PR1ME  400
and  up  (PR1ME put software last!)  on which (char*) and (int*) are not
the same length (and indeed char* is longer than  long),  is  there  any
good  reason for not having 'nullc' (null character pointer) and 'nullp'
(null pointer to some other type) as standard constants?

ron@brl-vgr.ARPA (Ron Natalie <ron>) (03/15/84)

You are right:
	generic	*p;

	p = 0;

it is not nescessarily true that (int)p == 0.  But it is true that
p == 0.  Plain and simple.