2012/4/12 Robert Dewar <de...@adacore.com>:
> 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.

I should have said: from everyone with whom I work. I'm not claiming
that this warning is useless for everybody, I'm basically saying that
it is often a nuisance/risk to convert existing code to bypass this
warning.

>  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,

I agree, they are actually a menace, and I do not want to touch them
without a good reason. Adding parentheses does not improve
readability, nor does it solves bugs in my own experience. Anyway,
precedence rules have to be known in order to remove the warning.

>  but ones that rely on knowing this precedence rule are
> a true menace if you ask me.

G++ has not warned about this for decades, so whether or not people
assuming basic precedence rules to be known are a menace, code that
does not make precedence explicit, is quite common and we have to cope
with it. And hopefully I'd rather not fix it everywhere.

> 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).

If you are aware of a simple tool that do that for C++, I am all ears
... But I'd rather have a new option to disable it ;-)

-- 
Fabien

Reply via email to