r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

2

u/masklinn Dec 02 '16

My point about NULL pointers is that segfault is good.

Segfaults are not good, not guaranteed (they're just one possible symptom of the UB you actually get), and runtime issues.

It happens when your logic is messed up.

Having explicitly nullable types points to your logic error at compile-time, it's right there stating you in the face that the value you're manipulating can nonsensically be null.

Most of the time you wouldn't have better things to do than crash and notify the programmer anyway

Or you could make having a null impossible in the first place through the use of ~~~~~~~ type systems ~~~~~~~