I think that depends on the situation.  In many cases, you're right,
there is nothing the program can do about the failure.  But in a
program with user interaction, for example, it may make sense to
prompt the user to retry or ignore the failure.

 Abort, Ignore, Retry?
 Remember that dreaded message? How many times have you made a choice
that was not "Abort" and actually did something? :P


  It makes sense for
you to recommend ignoring failures, but I don't see what is gained by
denying callers the opportunity to decide for themselves.

 Because it's a trap and a footgun all at once, and I don't agree that
there's any sensible decision to make apart from nothing or blowing up
the world. Not for the caller, not for the user - if anything, the
decision should fall back all the way to the admin. And Unix doesn't
have an easy way of doing that - abort() is the closest because it
rings a loud bell.

If you are in the rare case where you need to check the return code from
close(), then you should probably use close() directly, not a wrapper
around it.

--
 Laurent

Reply via email to