News for hackers. Stuff that matters.
Re:The Future That Never Was by irdc on Wednesday March 06, 2024 @07:59AM (#39615464)
> 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.

Re:The Future That Never Was by Tuna-Fish on Wednesday March 06, 2024 @08:55AM (#39615986)
Ironically, 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.
Re:The Future That Never Was by agumonkey on Wednesday March 06, 2024 @11:06AM (#39617364)
Amazing piece of trivia.
Re:The Future That Never Was by bluGill on Wednesday March 06, 2024 @12:52PM (#39618660)
C 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.
Re:The Future That Never Was by _a_a_a_ on Wednesday March 06, 2024 @01:42PM (#39619451)
> 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.

Re:The Future That Never Was by bluGill on Wednesday March 06, 2024 @06:02PM (#39622879)
0 is a valid pointer on some systems. So 0 could be address 0 or whatever NULL was (0xeeeeeee or something equally weird)
Re:The Future That Never Was by Tuna-Fish on Thursday March 07, 2024 @04:22AM (#39626929)
Nothing 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).