Re: C++ warnings from system header 'socketbits.h' : can we clean this up?

Horst von Brand (vonbrand@sleipnir.valparaiso.cl)
Sat, 13 Mar 1999 12:40:19 -0400


Ron Flory <ron.flory@ifrsys.com> said:

[...]

> Basically the problem is due to an old C hack where folks
> assume the macro NULL evaluates to 0. In C++ NULL is defined
> as '(void*) 0' which is quite distinct from zero, and may not
> be freely converted to an integer.

In C++ NULL can _not_ be defined that way: The standard explicitly states
that NULL is an integral expression that evaluates to zero.

You are probably using another header file that includes this broken
definition, or a broken C++ compiler. Note that the C++ support in
gcc-2.7.2.3 is very bad, check out egcs <http://egcs.cygnus.com>

> Here's the gcc output:
>
> /usr/include/socketbits.h: In function `struct cmsghdr *
> __cmsg_nxthdr(struct msghdr *, struct cmsghdr *)':
> In file included from /usr/include/sys/socket.h:34,
> from connect.cxx:8:
> /usr/include/socketbits.h:204: warning: ANSI C++ forbids implicit
> conversion from `void *' in return
> /usr/include/socketbits.h:213: warning: ANSI C++ forbids implicit
> conversion from `void *' in return

As you see, it is complaining about the use of "(void *) 0" here, and would
most probably complain for _each_ use of NULL...

-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616

- 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/