Lawrence Kirby wrote in message <918393784snz@genesis.demon.co.uk>...
>Null pointers work perfectly well on platforms where "address 0" can
>point to a valid object. However there is a reason for why a null pointer
>should compare equal to zero and that is that tests like if ()
>statements do the natural thing. Given that it makes sense for null
>pointer constants to be defined in a consistent way.
The reason people find this confusing (and it's clear that lots of people do find it confusing; I remember being very confused myself a while ago) is, I think, that 0 changes in meaning depending on the situation in which it's used.
Normally 0 means integer zero, but in some cases it means null pointer. It's natural to try to find a link between these and think of the null pointer as pointing to address 0, but as the FAQ makes clear this isn't a valid approach.
We're all familiar with operators changing their meaning according to context (the - operator behaving quite differently with pointers than with numbers, for example), but it's more surprising to see a constant acting that way.
Cheers,
Richard