Sergio Belkin wrote:
Thanks everyone, I guess the same thing goes for:
warning: ignoring return value of 'ssize_t write(int, const void*, size_t)'
declared with attribute 'warn_unused_result'
(The line in the source code is if(upLogPerror) ::write(2,logbuf,n); \ )
doesn't it?
Ignoring the result of write is usually a serious bug. However, that
line looks like it writes a log message to the standard error stream,
and in that specific case there might not be anything meaningful the
program can do if write fails, if it doesn't want to terminate with an
error status. Logging an error message about how logging failed could
easily lead to infinite recursion.
So depending on what other error reporting mechanisms are available to
the program, it may be reasonable to ignore the function result in this
case, but it should be done by tweaking the code to silence the
compiler warning for that call only. Disabling -Wunused-result for the
whole program is not a good idea.
Björn Persson