Live data from Hacker News

Null References: The Billion Dollar Mistake (2009) [video]

infoq.com

11–20 of 130 posts

Re: Null References: The Billion Dollar Mistake (2009) [video]

#11

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.

Genuinely curious: why don't suggest that to WG14?

(WG14) is the ISO workgroup which maintains the C specification.

Re: Null References: The Billion Dollar Mistake (2009) [video]

#12

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.

They're probably BOTH quite literally billion dollars mistakes.

Re: Null References: The Billion Dollar Mistake (2009) [video]

#14

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.

the choice of von neumann architecture over harvard architecture enabled this

Re: Null References: The Billion Dollar Mistake (2009) [video]

#16

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.

That’s a problem that’s pretty much limited to C. Null pointers have infected many other languages as well.

Re: Null References: The Billion Dollar Mistake (2009) [video]

#17
post #9

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.

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]

#19

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.

Re: Null References: The Billion Dollar Mistake (2009) [video]

#20

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.

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
Post reply on HN