On any of the ‘major platforms’ (which I’m defining as Windows, Mac and Linux for the purpose of this question,) is it conceivable for a validly allocated pointer to be allocated at address 0 in a programs address space (therefore messing up comparisons to NULL?)
Does the standard even allow a compiler/platform to have a valid allocation at address 0?
On any of the ‘major platforms’ (which I’m defining as Windows, Mac and Linux
Share
The C++ standard allows it, but such a pointer will not compare equal to literal
0(the NULL pointer constant).User-mode applications in the major OSes, however, will never have a valid pointer at 0, or even in the range -65536 to 65535 (to help detect offsets from a NULL pointer).
For the most part,
0as a usable address only exists in embedded systems, and very rarely in kernels of PC operating systems. But virtual memory systems reserve it, without any exceptions I’ve ever heard of.