4 ms·
> Failing to check the return value when closing a file may lead to silent loss of data. Checking, on the other hand, probably makes it loud loss of data.
by dllthomas 4y ago
> Failing to check the return value when closing a file may lead to silent loss of data.
Checking, on the other hand, probably makes it loud loss of data.
- turminal 4y agoWhy would it? If you care enough to check you probably also care enough not to discard the data you attempted to write.
- dllthomas 4y agoI was referring to checking because "you should check" when you don't actually care enough to structure your program around not losing the data. It's easy to to check and emit a diagnostic, it's harder to make sure you have collected the data you've written to a file descriptor and have something sensible to do with it if the close fails.