On 4/12/2012 4:55 AM, Fabien Chêne wrote:

I've got a radically different experience here, real bugs were
introduced while trying to remove this warning, and as far as I can
tell, I've never found any bugs involving precedence of&&  and || --
in the code I'm working on --, whose precedence is really well known
from everyone.

You simply can't make a claim on behalf of everyone like this, and it's
very easy to prove you wrong, i personally know many competent programmers who do NOT know this rule.

 In the real life, things are not as simple as (a&&  b)
|| ( c&&  d), some checks usually lie over more than five lines. This
warning applied to such checks are really a pain to remove.

a) complex conditionals over five lines are a bit of a menace
anyway, but ones that rely on knowing this precedence rule are
a true menace if you ask me.

b) it should be trivial to remove this warning, as it is a simple
automatic refactoring that should be easily done with a tool (most
certainly the automatic refactoring available in GPS for GNAT would
take care of this, if it needed to, which it does not, since in Ada
parentheses are required in such cases (the designers of Ada most
certainly disagreed with you that everyone knows this warning).

We shall definitely have an option to remove this very warning,
without  getting rid of the whole sets of usefull warnings embedded in
-Wparentheses.

Yes, that seems a perfectly reasonable proposition. In GNAT there is
a very general mechanism to suppress any specific warning (pragma
Warnings (Off, string), where string matches the text of the message
you want to suppress)) as well as a long list of specific warnings
switches, similar to what we have in GNU C.


Reply via email to