←back to thread

218 points signa11 | 1 comments | | HN request time: 0.201s | source
Show context
9d ◴[] No.43681256[source]
> C doesn't try to save you from making mistakes. It has very few opinions about your code and happily assumes that you know exactly what you're doing. Freedom with responsibility.

I love C because it doesn't make my life very inconvenient to protect me from stubbing my toe in it. I hate C when I stub my toe in it.

replies(5): >>43682578 #>>43683142 #>>43683157 #>>43683835 #>>43684772 #
0xEF ◴[] No.43683157[source]
I've heard it put another way that I enjoyed: "C assumes you know what you're doing, which is only a problem if you don't know what you're doing."
replies(1): >>43683687 #
tialaramex ◴[] No.43683687[source]
Having spent many, many years paid to write C, and with no wish to write any more now than I learned Rust, I would suggest a rewording:

"C assumes you know what you're doing, which is only a problem because you don't know what you're doing."

Periodically, especially in r/cpp I run into people who are apparently faultless and so don't make the mistakes that make these languages dangerous, weirdly none of these people seem to have written any software I can inspect to see for myself what that looks like, and furthermore the universe I live in doesn't seem to have any of the resulting software. I choose to interpret this mystery as: People are idiots and liars, but of course there could be other interpretations.

replies(2): >>43683712 #>>43702991 #
1. ryao ◴[] No.43702991[source]
I wonder if in a few years you will never want to write another line of Rust again like another developer I know who used to be enamored with Rust.

That said, I have not written perfect C code myself, but I have fixed a number of mistakes others made in their C code. Many of my commits to OpenZFS were done to fix others’ mistakes. A few of my commits even contained my own mistakes that I or others later caught. Feel free to inspect the codebase yourself. You should find it is a very well written codebase