------- Additional Comments From glebius at FreeBSD dot org 2005-09-19 13:21 ------- Subject: Re: -Wparentheses doesn't catch all assignments used as truth value
On Mon, Sep 19, 2005 at 01:14:18PM -0000, falk at debian dot org wrote: f> > Well, all these examples are assignments. I don't agree that '=' is a somewhat f> > unique or special assignment. f> f> But of course it is. It is the only case where people make mistakes. Not true :) http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netgraph/ng_pppoe.c Revisions 1.75 and 1.35. f> > According to documentation (and that would be f> > logically correct) any kind of assignment should be caught when used as truth f> > value without additional parentheses. f> f> "logically correct" is not a meaningful concept when dealing with warnings. f> The question is rather whether they flag code that is frequently mistaken. f> And I don't see that for these cases. So at best we could "fix" the f> documentation, although that seems unneccesarily pedantic to me. According to documentation -Wparentheses catches not human typos or misreadings but a strictly defined constructions. And all listed above constructions fall into the definition. I understand your unwillingness to change this, because this might break builds of some products that use gcc. But almost every new gcc release does this :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23964