Re: bug in socket.h (and maybe many other kernel headerfiles)

Steve VanDevender (stevev@efn.org)
Fri, 17 Sep 1999 14:57:52 -0700 (PDT)


david parsons writes:
> In article <linux.kernel.Pine.LNX.3.95.990917152427.370A-100000@chaos.analogic.com>,
> Richard B. Johnson <root@chaos.analogic.com> wrote:

> >The kernel code is written in C. C requires that NULL be defined as
> >(void *)0.
>
> Is this a C9x thing? It's handy that GNU casts NULL to (void*)0,
> but I don't think pre-9x C requires that sizeof(NULL) == sizeof(void*).

In ANSI C the integer value 0 cast to any pointer type produces a
null pointer (but a null pointer is not required to have a
representation consisting of all binary 0s).

A void * can be cast to any other pointer type.

It is perfectly legal and functionally correct to define NULL as 0.
It is probably functionally the same to define NULL as (void *) 0.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/