Hacker News new | past | comments | ask | show | jobs | submit login

The article does seem to nitpick a C++ design and then highlight the same feature in Rust. The way getline failed there is not "accidental" but the design of fstreams/getline, so that "less-careful" programmers don't have those corners here.

Thing is, all of the solutions to the issue here would be a real PITA if done as one function as both examples are. That is why example code often skips checks to allow the point of the article to be highlighted and not hide it. This is more true with filesystems related code as filesystems are not reliable. One example of how many corners filesytems have is the unit tests for sqlite, they are amazing.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: