[Bug c/23964] -Wparentheses doesn't catch all assignments used as truth value

falk at debian dot org gcc-bugzilla@gcc.gnu.org
Mon Sep 19 12:28:00 GMT 2005


------- Additional Comments From falk at debian dot org  2005-09-19 12:28 -------
(In reply to comment #0)
> The -Wparentheses switch (as well as -Wall) doesn't catch logical assignments
used as truth values. For example:
> 
> int i = 0;
> 
> if (i |= 1) {};
> if (i ^= 1) {};
> if (i &= 1) {};

What kind of confusion could the code above create in a reader? This code
seems pretty unambiguous to me, so why warn?


-- 


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



More information about the Gcc-bugs mailing list