3 ms·
The second item is warning against a particular misuse of pointers that was apparently widespread at the time. On VAX Unix, it happened that the memory at addre
by pm215 6y ago
The second item is warning against a particular misuse of pointers that was apparently widespread at the time. On VAX Unix, it happened that the memory at address zero of a process was readable and contained zeroes. So a lot of code would misuse a NULL pointer as being equivalent to a pointer-to-an-empty-string, for instance: worked fine on the VAX!. So it's kind of a specific flavour of commandment 10. These days the common machines don't have a readable address zero, and all the old non-portable code has faded into history.
- asveikau 6y ago16-bit x86 also had the interrupt handler table at linear address 0, I seem to recall some compilers for DOS that would make NULL point at that.
- oriolid 6y agoYes. At least writing to interrupt vector table usually crashed your computer right at the point. I remember a certain DSP architecture that system flags near zero address. It was an interesting experience to debug a program that failed because a write to struct member through null pointer switched the machine to a different instruction set.
- kevin_thibedeau 6y agoEvery MMU-less micro lets you read address 0.
- monocasa 6y agoA lot of micros have MPUs that'll catch address 0 accesses without a full MMU. AFAIK all ARMs newer than ARM7 (ie. ARMv5) have one for instance.
- RealityVoid 6y agoYeah, they will, if you activated it. And if you made access to 0 address be caught explicitly ( you might have the MMU active but not have it configured in such a way)
- illuminated 6y agoYes, I know and I agree, I just said I'd rather put a more broad message there
- bnjf 6y agoright. compat for this still exists on solaris at least, as lib0@0: see the notes section at the bottom of [0]. [0] - https://docs.oracle.com/cd/E19683-01/816-0210/6m6nb7md6/index.html https://docs.oracle.com/cd/E19683-01/816-0210/6m6nb7md6/inde...
- burfog 6y agoThat could enable optimization. The compiler could remove many NULL-pointer checks. On many platforms, all that is required is a change to the compiler. It could emit a ".quad 0" or equivalent, in a common data section at absolute address zero. Some platforms would require linker changes or even kernel changes.