This is the mail archive of the egcs-bugs@egcs.cygnus.com mailing list for the EGCS project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Too many warnings.




>     int i, j;
>     void f()
>     {
>       i++ && (j=84);
>     }
[snip]
>     #.c:4: warning: value computed is not used

> In this case it seems to me it would be reasonable
> for the compiler to deduce everything is indeed needed.

The compiler is doing the correct thing here.  It's not the i++ nor
the (j=84) that's causing the complaint.  It's the result of the 
&& expression, that is,

    (truth value)  &&  (truth value)

yields another truth value, and /that/ isn't being used.  If you
declare another int, say 'q', and assign to it,

    q = i++ && (j=84);

the warning goes away.


(If you reply to the list, please don't cc another copy to me.  Thanks!)
Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]