[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why 'statement may have no effect' lint warning here?
From: |
Wolfgang Laun |
Subject: |
Re: Why 'statement may have no effect' lint warning here? |
Date: |
Wed, 14 Apr 2021 08:07:23 +0200 |
On Wed, 14 Apr 2021 at 07:16, <arnold@skeeve.com> wrote:
>
> Rather, it does try to point out real semantic mistakes, such as
>
> a + b # useless statement
>
I am working to striaghten this out and will eventually post a patch.
>
We all agree with lint not being a code quality analysis tool.
If I understand you correctly, you intend to fix the current misbehaviour
so that only truly useless statements should be flagged.
I don't want to make life hard for you but can you please clarify your
intention. Which of the following will lint flag after your fix?
a + b # as above: useless
a == b # as above: useless
a++ == a-- # ?
f_without_side_effect(a); # ?
f_with_side_effect(b) == 2 # ?
1 == 2 && a++ # ?
1 == 1 || b-- # ?
a = a # ?
a *= 1 #?
a += 0 #?
a*a < 0 && b = 1001 # ?
and so on - you get the drift.
Will you be able to describe the situation after the patch in a single,
simple sentence?
I'd say that "any expression statement that contains a logical expression
that may inhibit the execution of subexpressions with side effects or
function calls" would be such a sentence, but, alas, it would require a ==
1 && b = 2 to be flagged.
Wolfgang Laun
- Re: Why 'statement may have no effect' lint warning here?, (continued)
Message not available
- Re: Why 'statement may have no effect' lint warning here?, Manuel Collado, 2021/04/13
- Re: Why 'statement may have no effect' lint warning here?, Wolfgang Laun, 2021/04/13
- Re: Why 'statement may have no effect' lint warning here?, Manuel Collado, 2021/04/13
- Re: Why 'statement may have no effect' lint warning here?, arnold, 2021/04/14
- Re: Why 'statement may have no effect' lint warning here?,
Wolfgang Laun <=
- Re: Why 'statement may have no effect' lint warning here?, arnold, 2021/04/14
- Re: Why 'statement may have no effect' lint warning here?, arnold, 2021/04/14
- Re: Why 'statement may have no effect' lint warning here?, Wolfgang Laun, 2021/04/14
Re: Why 'statement may have no effect' lint warning here?, Manuel Collado, 2021/04/14
Re: Why 'statement may have no effect' lint warning here?, arnold, 2021/04/14