3 ms·
> While you can do pointer arithmatic there will be null pointers There is no reason why the concept of a null pointer has to exist. If there were no special n
by twanvl 10y ago
> While you can do pointer arithmatic there will be null pointers
There is no reason why the concept of a null pointer has to exist. If there were no special null pointers it would be perfectly okay for the operating system to actually allocate memory at 0x00000000. With unrestricted pointer arithmetic you can of course make invalid pointers, but a reasonable restriction is to only allow `pointer+integer -> pointer` and `pointer-pointer -> integer`. You can't make a null pointer with just those.