Live data from Hacker News

NULL: The worst mistake of computer science? (2015)

lucidchart.com

11–20 of 377 posts

Re: NULL: The worst mistake of computer science? (2015)

#11
post #5

Nulls in strongly typed languages can get rather weird but from a C/C++ perspective it is the same as 0. nullptr is just a correctly casted 0.

nullptr is actually "a prvalue of type std::nullptr_t" or something like that. Since C++11 NULL is the same as nullptr.

Re: NULL: The worst mistake of computer science? (2015)

#14
post #8

Other candidates: - null terminated strings - machine dependent integer widths

Null-terminated strings are useful for buffering values of unknown length (e.g. copying from a network stream). Length-prefixed strings have issues of their own (e.g. what size length prefix to use, efficient encoding of variable-length integer prefixes, what happens if a length-prefixed string's calculated end-position is outside the process' memory space?)

Re: NULL: The worst mistake of computer science? (2015)

#16
post #5

Nulls in strongly typed languages can get rather weird but from a C/C++ perspective it is the same as 0. nullptr is just a correctly casted 0.

nullptr is actually "a prvalue of type std::nullptr_t" or something like that. Since C++11 NULL is the same as nullptr.

And it is directly convertible to a bool. The primary effectiveness seems to be with operator overloading where a NULL could trigger an integer method instead of a pointer method.

Re: NULL: The worst mistake of computer science? (2015)

#18

"The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt. – Rob Pike" When d…

>When did computer science become about hand holding?

When people with pragmatic goals want to get large teams of new programmers productive fast, and can't expect everyone to be able to fend on their own or can afford the cost of accumulated mistakes.

>Look at react. It was designed to force functional programming concepts in an OOP manner.

Whatever that means, as React has little to do with "OOP manner".

Re: NULL: The worst mistake of computer science? (2015)

#19
post #15

Whether null/NULL is a good a idea or not (I like it, just yesterday it saved my ass) it saddens me that more and more articles I stumble upon are made to criticize technologies but not to talk about solutions or innovations

The article talks about a solution, suggesting that optionals are a much better way to handle this.
Post reply on HN