3 ms·
The specific section of his 'Learn C the Hard Way' book that he's referring to was mostly, as I recall, complaining that the C string functions defined in K&R w
by ori_b 10y ago
The specific section of his 'Learn C the Hard Way' book that he's referring to was mostly, as I recall, complaining that the C string functions defined in K&R will fail when you don't pass them valid data, and therefore, they're fundamentally broken.
Make of that what you will, but it seems to me that given all of the other ways that C can blow up due to programmer error, it seems reasonable to expect programmers to pass a valid string to a string function.
- mveety 10y agoYeah, I agree. This is similar to complaining that the plane was broken when you fly it into a mountain. I can see this being a minor issue when you're passing data to like strdup(2) from an unknown source, but you should be following the rule of "users do dumb shit." and check these things. C isn't designed to prevent you from hanging yourself because if it were to prevent you you wouldn't have enough rope to climb a mountain.
- regularfry 10y agoI'm with Zed on this one. Giving the programmer fewer things to have to remember, by design, is a de facto improvement. Forcing a human to repeatedly do a task which could have been designed out is evidence of a bad design. Mind you, we're talking about the stdlib here. You can swap this stuff out. Some people do: djb is a fairly well-known example.