Also, (void *)0 is a null pointer, even in a stdargs function: as Ian
pointed out, NULL-the-macro may be defined as '0', which is not a pointer
in a stdargs context and may have a different bit value.
Posted Mar 21, 2008 4:22 UTC (Fri) by mikov (subscriber, #33179)
[Link]
It took me by surprise that most people here expect NULL to be (void)0. My impression from the
C and C++ standards (which admittedly I haven't looked at recently) is that 0 is the
preferable definition for NULL. Not 0L and not (void)0.
(I know that GCC's headers define it as (void)0. However if it was changed to plain 0, all
correct ANSI C programs should continue to work!)
So, the only clearly correct, portable and even stylistically preferable solution in this case
is ((char*)0). I am surprised that there is discussion about it at all.