Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src

On Thu, Sep 01, 2011 at 08:19:07AM +0100, Iain Hibbert wrote:
> On Wed, 31 Aug 2011, Warner Losh wrote:
> > In the absence of both the prototype and a cast, NULL (which can be 0)
> > will be passed as an int, not as a pointer.
> NetBSD C headers define NULL as ((void *)0), and our Makefiles use -Wall
> (includes -Wimplicit-function-declaration) to avoid such situations..

ISTR that ansi C (or some recent version of it) does require that
NULL be a pointer constant - so that it gets passed correctly to
varargs functions that expect a data pointer.

Without function prototypes this is a bigger problem, especially
since (char *)0 isn't a useful definition!
This is where 'lint' comes in handy, since it (effectively) checked
that args matched the inferred prototype ...


David Laight:

Home | Main Index | Thread Index | Old Index