|
From: | Eric Blake |
Subject: | Re: failure to build due to ignoring fwrite() result |
Date: | Mon, 30 Aug 2010 14:53:11 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2 |
On 08/30/2010 02:48 PM, Paul Eggert wrote:
On 08/30/10 12:52, Jim Meyering wrote:However, for the vast majority of the functions marked with this attribute, ignoring the return value really is a bug in all but a very small fraction of the use cases.That may well be, but that's not the issue. The issue is whether the cost of using -Wunused-result exceeds its benefits. The cost accrues in the cases where it's not a bug to ignore the returned value, possibly because it's a function like fwrite or strtod that should never have been marked with __attribute__ ((__warn_unused_result__)). The benefit accrues in the cases where using -Wunused-result catches significant bugs that would not be caught otherwise.
Which takes us back to the argument that if a function is poorly marked, it should be easy to override that poor marking, so that the rest of the code using that function does not have to mark it with ignore_value, while not crippling the remaining functions where it makes sense.
I'm leaning even more heavily towards a patch to gnulib's stdio.in.h that undoes the poor glibc marking on fwrite.
-- Eric Blake address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |