lkml.org 
[lkml]   [1999]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: bug in socket.h (and maybe many other kernel headerfiles)
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/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.064 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site