tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __attribute__((warn_unused_result)) for NetBSD?



On Sun, Sep 14, 2008 at 07:53:55PM -0400, der Mouse wrote:
> >> Why?  IMO Not checking for return value of all these functions as
> >> well as close fclose etc. is VERY dangerous.
> > Please, explain to me what exactly you intend to do to handle an
> > error return from close().
> 
> I didn't write that.  But the answer seems pretty obvious: report it to
> wherever is appropriate for errors on the file in question.
> 
> Typically an error from close() will be something like a delayed-write
> I/O error, something the file writer quite likely wants to hear about.

You might be able to report it to the user.  However, it's among those
errors for which, I think, if you consider actual use cases carefully,
it is least likely that you can actually take corrective action.  After
all, you've closed the file.  Across a close, all kinds of normal Unix
I/O semantics you might expect are simply not going to hold...

Thor


Home | Main Index | Thread Index | Old Index