On 14/06/16 10:32, Florian Weimer wrote:
A long time ago, GCC decided that warn_unused_result warnings should
*not* be silenced by casting to void, as in:

    (void) write (STDOUT_FILENO, message, strlen (message));

Apparently, programmers have figured out to use this idiom as a replacement:

    if (write (STDOUT_FILENO, message, strlen (message))) { }

I'm not sure if this is an improvement.  The (void) idiom seems to make
the programmer intention more explicit.

Maybe it's time to reconsider and suppress the warning for casts to
(void), too?

Yes there a ways to suppress the warning, like:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/ignore-value.h;hb=HEAD

It would be great to have the standard (void) mechanism work.
It is an explicit request from the programmer after all.

thanks,
Pádraig

Reply via email to