3 ms·
> Probably the worst CPU architectural mistake of all time is locating that table at address 0. That’s not something unique to x86; eg. the PDP-11 also had its
by irdc 3y ago
> Probably the worst CPU architectural mistake of all time is locating that table at address 0.
That’s not something unique to x86; eg. the PDP-11 also had its interrupt vector table starting at address 0. This only became a real problem when languages that treated address 0 as a sentinel value became popular.
- Tuna-Fish 3y agoIronically, C originally used 0 as a sentinel address precisely because it could not hold a real value, because that's where the interrupt table was.
- agumonkey 3y agoAmazing piece of trivia.
- bluGill 3y agoC did not say 0 was the sentinel address. Most implementations had it as 0, but it could be any address, and K&R (first edition - highly recommended) had a table of what NULL was on various platforms - most were 0, but not all. In C++98 0 was the sentinel address, resulting in the compiler having to guess if you really meant 0 or whatever NULL really was when you have 0 in the code if NULL wasn't 0. C++11 introduced nullptr which is implementation defined.
- _a_a_a_ 3y ago> resulting in the compiler having to guess if you really meant 0 or whatever NULL IIRC you had to cast 0 to a pointer, which made it a null pointer as distinct from arithmetic zero. Or am I confusing myself... It's been a while.
- bluGill 3y ago0 is a valid pointer on some systems. So 0 could be address 0 or whatever NULL was (0xeeeeeee or something equally weird)
- Tuna-Fish 3y agoNothing got defined until much later, it's just that the early implementation of C used a 0, because it was not an usable address and they didn't want to burn any usable address space (of which there was only 56k on the PDP-11).