marian-dev
marian-dev copied to clipboard
fclose can fail, but Marian doesn't check for that
https://github.com/marian-nmt/marian-dev/blob/e9aa7ad340bc3e407add08ef5015f3cbf7e00485/src/common/binary.cpp#L81
This entire piece of code inside the #if irks me. Tempted to remove it just to see what breaks and where and for whom.
No, this is a close on read. It cannot fail. Don't add a check.
Close is a destructor, there should be no error condition (other than you are trying to close something you didn't open, which is not something we are concerned with here).
For writing, the correct way is to flush before close and check on that, then don't check on close.