This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] PR/24900: computed but not used cast values
- From: Ian Lance Taylor <ian at airs dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, joseph at codesourcery dot com
- Date: 17 Nov 2005 14:01:56 -0800
- Subject: Re: [RFC] PR/24900: computed but not used cast values
- References: <20051117213300.GA15008@redhat.com>
Aldy Hernandez <aldyh@redhat.com> writes:
> this reduces to:
>
> int f(void);
> void g(void)
> { (unsigned) f(); }
>
> Which was made to deliberately warn by Joseph's patch here:
>
> http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00275.html
>
> I closed the bug as a WONTFIX, but Ian suggested I bring this up on the
> list, as he believes the choice to warn on this, isn't a good one.
Basically, I don't think it helps anybody to issue a "value computed
is not used" warning for:
(unsigned) f();
We traditionally do not warn about not using the value returned by a
function. And I don't see why adding a cast should change that.
Intuitively, a cast by itself is not a computation.
Ian