[Lsb-infrastructure] definition of NULL

Wichmann, Mats D mats.d.wichmann at intel.com
Tue Sep 9 05:45:34 PDT 2008


Seems like the definition of NULL in LSB could
be improved.

There's already a comment in LSB's stddef.h that
"(void *) would be better, but causes problems with C++".
We now have a mechanism for that which didn't exist
at the time.

The upstream definition looks like:

#ifndef __cplusplus
#define NULL ((void *)0)
#else  /* C++ */
#define NULL 0
#endif

Further, there's also a protection mechanism, glibc
headers while are likely to need it define __need_NULL
and leave it to gcc's stddef.h so it's not defined
multiple times. I'm seeing lots of messages about NULL
in the xts5 build log (which is admittedly a *bit* of
a special case) so we might want to at least protect
it with #ifndef NULL like we do for TRUE and FALSE.




More information about the lsb-infrastructure mailing list