Nah. The billion dollar mistake is actually C arrays decaying to pointers, enabling buffer overflows, the #1 cause of bugs and malware injection in shipped C programs. https://www.digitalmars.com/articles/C-biggest-mistake.html It's simple to fix this in C, too.
Nothing is decaying. It is an implicit conversion. To say something "decays" implies something else is lost, the array is still there.
Null References: The Billion Dollar Mistake (2009) [video]
31–40 of 130 posts
Re: Null References: The Billion Dollar Mistake (2009) [video]
#32So it just took some time to get mainstream.
Re: Null References: The Billion Dollar Mistake (2009) [video]
#33Earlier quoted context omitted.
I think this is actually an artifact of the 'check the single return value for errors' that requires that the return domain contain at least one error code point. how else you might structure errors without changing much of the rest of C left for an exercise
just require the programmer to check errno after every function call? /s
Re: Null References: The Billion Dollar Mistake (2009) [video]
#34Earlier quoted context omitted.
I think golang's slices are a better solution than the linked article. https://go.dev/ref/spec#Slice_types Slices can still be nil (null), but it isn't an unsafe memory access operation, just another type of potentially useful or potentially errant invocation to handle.
Zig and Rust also support array slices. But they can’t be null, because that’s - as the article says - a mistake. https://ziglang.org/documentation/master/#Slices https://doc.rust-lang.org/book/ch04-03-slices.html
Re: Null References: The Billion Dollar Mistake (2009) [video]
#35Earlier quoted context omitted.
Which would all be a rounding area if C gets to take credit for everything produced using it.
This is what C/C++ haters, anti x86/amd64 snobs, and Rust elitists always forget: what works, works. Sure, it could be a local maximum, hopefully there will be better, but who knows? To quote Sean Connery in The Rock: Losers always whine about their best. Winners go home and fuck the prom queen! https://m.youtube.com/watch?v=gXDSxgDUv-c
So we know there are other ways, we used systems with zero lines of C into them.
The prom queen came naked offering herself to everyone and the party was done for the other folks.
Re: Null References: The Billion Dollar Mistake (2009) [video]
#36The compiler should check for null reference before deferencing here.
At the cost of basically all performance or incredible compiler complexity. A better solution: Implement a different language with a better type system instead. Or pick one of the hundreds that already exist and can represent the concept of a tagged union without having to implement it manually.
Re: Null References: The Billion Dollar Mistake (2009) [video]
#37Re: Null References: The Billion Dollar Mistake (2009) [video]
#38Earlier quoted context omitted.
This is what C/C++ haters, anti x86/amd64 snobs, and Rust elitists always forget: what works, works. Sure, it could be a local maximum, hopefully there will be better, but who knows? To quote Sean Connery in The Rock: Losers always whine about their best. Winners go home and fuck the prom queen! https://m.youtube.com/watch?v=gXDSxgDUv-c
Some of us are old enough to be coding when C was only relevant for university departments privileged to have UNIX boxes. So we know there are other ways, we used systems with zero lines of C into them. The prom queen came naked offering herself to everyone and the party was done for the other folks.
If you are old enough to remember those days, then you remember COBOL, Algol, Fortran, Pascal, BASIC, Ada, Oberon, Lisp/Scheme, Forth, O’Caml etc. They’re all great languages, some still have their uses. There’s a reason all of the major operating systems have cores written in C/C++. It’s entirely because they’re pragmatic and “work”, and not some conspiracy.
Edit: although now that I write it, what if C/C++ was planted on earth by an alien intelligence in order to slow down the development of the human race.
Re: Null References: The Billion Dollar Mistake (2009) [video]
#39Earlier quoted context omitted.
I think this is actually an artifact of the 'check the single return value for errors' that requires that the return domain contain at least one error code point. how else you might structure errors without changing much of the rest of C left for an exercise
just require the programmer to check errno after every function call? /s
error_t oops;
int x = foo(10, &oops);
if(oops)
goto whoops;
int x = foo(10, 0); // yolo!Re: Null References: The Billion Dollar Mistake (2009) [video]
#40Earlier quoted context omitted.
Which would all be a rounding area if C gets to take credit for everything produced using it.
This is what C/C++ haters, anti x86/amd64 snobs, and Rust elitists always forget: what works, works. Sure, it could be a local maximum, hopefully there will be better, but who knows? To quote Sean Connery in The Rock: Losers always whine about their best. Winners go home and fuck the prom queen! https://m.youtube.com/watch?v=gXDSxgDUv-c