This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/17257] Some assignment operators do not trigger "assignment used as * truth value" warning


------- Additional Comments From tlambert2 at mindspring dot com  2004-09-01 00:22 -------
Subject: Re:  Some assignment operators do not trigger
 "assignment used as * truth value" warning

I mention this because of recent confusion between != and |= in a patch provided by an external third party.

I could see a similar issue arising with += vs. == on machines where + is the shift of = on the keyboard, and the person happened to be typing quickly.  I could also see (though more rarely, accidental inclusion of an = following an operator like *.

Would making this a warning when assignment warnings were enabled typicaly result in a large number of additional warnings, or would it typically result in no additional warnings?  I.e. would this be mostly harmful, or mostly harmless?

Thanks,
-- Terry

-----Original Message-----
From: jsm at polyomino dot org dot uk <gcc-bugzilla@gcc.gnu.org>
Sent: Aug 31, 2004 5:17 PM
To: tlambert2@mindspring.com
Subject: [Bug c/17257] Some assignment operators do not trigger "assignment used as * truth value" warning


------- Additional Comments From jsm at polyomino dot org dot uk  2004-09-01 00:17 -------
Subject: Re:  New: Some assignment operators do not trigger
 "assignment used as * truth value" warning

On Wed, 1 Sep 2004, tlambert2 at mindspring dot com wrote:

> /*
>  * Some assignment operators do not trigger "assignment used as
>  * truth value" warning.  This seems wrong.  The following code,
>  * when compiled with "-Wall" only causes the compiler to emit a
>  * single warning, only for the direct assignment.  The same effect
>  * is present on Macintosh (gcc 3.3 PPC) and Linux x86 platforms.
>  */

This is by design.  The warning is specifically for potential confusion 
between = and ==.





-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17257


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