C++ issue on 4.11: kpopupmenu.h [Please review]
Mike Edenfield
kutulu at kutulu.org
Thu Mar 10 11:38:30 PST 2005
Simon Barner wrote:
> Volker Stolz wrote:
> [...]
>
>> As far as I know, all systems with NULL != 0L have either been
molten down
>> or are otherwise not in a position to run KDE :)
>
>
>
> Volker,
>
> AFAIK, null pointers in C++ are supposed to be written as 0 (or OL for
> (some?) 64 bit platforms).
In the context of a pointer (that is, wherever a pointer value is
expected), the constant 0 *is* a null pointer, regardless of what actual
underlying value is stored for such pointers. That is, (int)0 and
(void *)0 do not have to be the same sequence of bits. The NULL typedef
is simply used to force the 0 constant to be a pointer by typecasting it
to (void *), so the compiler can never confuse it with an integeral
constant.
Or, to summary the answer to the OP's question:
For ALL systems that are standards compliant, NULL == (void *)0. For
most currently operating modern processors, (void *)0 is saved as a
32-bits-zero or 64-bits-zero number. However, those two statements are
coincidentally, not causally, related.
--Mike
More information about the freebsd-ports
mailing list