3 ms·
Null certainly must exist at the target level. I'm not denying that. But languages can be designed to abstract nullability into controlled forms like Option/May
by _hardwaregeek 7y ago
Null certainly must exist at the target level. I'm not denying that. But languages can be designed to abstract nullability into controlled forms like Option/Maybe.
- XMPPwocky 7y ago> Null certainly must exist at the target level. Why? If anything, null must not exist at the target level- having a dedicated region of memory just for "accesses here are bad" at 0x0 isn't ubiquitous, and even having that at all isn't guaranteed (especially in embedded, where you might not get memory protection!). Modern operating systems have to keep userland from mapping the 0x0 page because it turns out programmers just cannot keep themselves from dereferencing NULL, and that's often exploitable when done from the kernel.
- sjolsen 7y ago>especially in embedded, where you might not get memory protection! Or where there's perfectly valid memory mapped to address 0
- WalterBright 7y agoThe 8086 put the DOS vector table at address 0, in retrospect a truly terrible choice. Any null pointer writes would trash the operating system. A much better design would have been to put the system ROMs at 0, where at least DOS would survive a null pointer.