coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] ignore-value.h considered harmful


From: Eric Blake
Subject: Re: [coreutils] ignore-value.h considered harmful
Date: Wed, 11 Aug 2010 07:39:14 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100805 Red Hat/3.1.2-2.el6 Mnenhy/0.8.3 Thunderbird/3.1.2

On 08/10/2010 09:56 PM, Paul Eggert wrote:
> Re that recent change to sort.c to insert a call to ignore_value.
> 
> This ignore_value business is ugly, and
> runs against the spirit of the GNU coding standards:
> 
>   "Don't make the program ugly to placate lint.
>    Please don't insert any casts to void."
> 
>   <http://www.gnu.org/prep/standards/html_node/Syntactic-Conventions.html>
> 
> How about if we suppress those GCC warnings instead, using
> -Wno-unused-result or whatever-it-is?  The cost of this
> particular warning seems to be greater than its benefits.

I've seen several benefits, such as catching missed error checking on
system calls.  I'd rather keep -Wunused-result active, for this reason.
 But since it is debatable which system library headers should be thus
marked, I see no option but to have a way to conveniently ignore the
warning on the few places where ignoring the result is intentional.
Ultimately, ignore_value(x) looks a lot better than (void)x, so we're
still complying with the letter of the "no casts to void" if not the spirit.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]