On 07/05/2011 09:49 AM, Markus Armbruster wrote:
> If 'ret' has been used to silence compiler warnings about functions
> which have been declared with attribute __warn_unused_result__
> (eg write() and various other libc functions) then "(void)write()"
> is insufficient -- gcc requires the variable.
gcc being silly. Oh well.
In this particular case I think that the return value should be checked.
It's good if something is printed in the log saying that the reset
wasn't done for some reason---even if it is just defensive.
The really silly thing is in glibc, not gcc. __warn_unused_result__ was
added to fwrite, where you have no certainty that the write has been
done, but not to either fclose or fflush. Oh well...
Paolo