This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/17257] Some assignment operators do not trigger "assignment used as * truth value" warning
- From: "tlambert2 at mindspring dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Sep 2004 00:22:52 -0000
- Subject: [Bug c/17257] Some assignment operators do not trigger "assignment used as * truth value" warning
- References: <20040901001242.17257.tlambert2@mindspring.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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