develooper Front page | perl.perl5.porters | Postings from June 2013

Re: warning from perl.c:103 ignoring return value of 'write'

Thread Previous | Thread Next
Peter Martini
June 22, 2013 07:07
Re: warning from perl.c:103 ignoring return value of 'write'
Message ID:
On Thu, Nov 22, 2012 at 11:32 AM, Craig A. Berry
<> wrote:
> On Wed, Nov 21, 2012 at 3:26 PM, Karl Williamson
> <> wrote:
>> On 11/21/2012 12:11 PM, Craig A. Berry wrote:
>>> I agree.  Which compiler?
>> gcc version 4.4.5.
> Apparently this doesn't derive from the use of -Wunused-result but
> from the attribute with which the function is declared.  Expanding on
> the stackoverflow article at
> <>,
> you can see from my example at the end of this message that:
> 1.) -Wunused-result is on by default, but you can turn it off with
> -Wno-unused-result.
> 2.) It does not affect functions declared with a return value unless
> they also have the warn_unused_result attribute.  In other words, it
> does absolutely nothing for the common case where someone creates a
> function that returns a value but forgets to check that value.
> 3.) As we've already seen the attribute trumps casting to void.
> Since we don't have control over the attributes of the functions in
> libc, I think the choices are to either turn off the warning or use
> one of the workarounds posted in this thread.  Or live with the
> eyeball strain of ignoring the useless warnings, which makes it
> tempting to ignore all warnings, as if people needed an incentive for
> that.

Reviving this older thread, with a patch to apply one of the
workarounds.  Or if someone wants to apply a different workaround, I'm
not picky :-)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About