tech-userlevel archive

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

Re: definition of NULL correct?



Arnaud Lacombe <lacombar%gmail.com@localhost> writes:

> make sense,  any objection to fix NULL definition ?
>
> --- a/sys/sys/null.h
> +++ b/sys/sys/null.h
> @@ -5,7 +5,7 @@
>  #ifndef        NULL
>  #if !defined(__GNUG__) || __GNUG__ < 2 || (__GNUG__ == 2 &&
> __GNUC_MINOR__ < 90)
>  #if !defined(__cplusplus)
> -#define        NULL    (void *)0
> +#define        NULL    ((void *)0)
>  #else
>  #define        NULL    0
>  #endif /* !__cplusplus */

So far I'm not convinced that our previous definition is wrong, or that
"sizeof NULL" is valid (in the sense that it must work in all conforming
environments).  There's a general tradition in macros to parenthesize
the whole thing and the arguments so that various usages work, and in
this case there's also the issue of dealing with other code that's
really out there.

So all in all I think adding () is a good step.

Attachment: pgpVibEjZykTt.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index