Thread overview
[Issue 5540] Probable bug-hiding redundancies
Dec 09, 2015
Infiltrator
May 22, 2018
Dmitry Olshansky
May 22, 2018
Dmitry Olshansky
Aug 15, 2022
RazvanN
December 09, 2015
https://issues.dlang.org/show_bug.cgi?id=5540

Infiltrator <lt.infiltrator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lt.infiltrator@gmail.com

--- Comment #7 from Infiltrator <lt.infiltrator@gmail.com> ---
I think that you're being a little too zealous.  For instance, foo() in your last example, and any function in general, may not necessarily be pure (in the mathematical sense) so they may produce different results and/or side-effects.

--
May 22, 2018
https://issues.dlang.org/show_bug.cgi?id=5540

Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com

--- Comment #8 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
I think indeed for expressions that are trivially true (or false) there must be an error in the context of || and &&. x == x and x != x is a popular mistake.

Except for true/false literals as they are often used for debugging and disabling parts of program explicitly. It's a balancing act but a lot of vlaue to be had.

On the other hand I'd really just give this to dscanner or simillar lint. I tried dscanner right now but it doesn't seem to pick it up.

--
May 22, 2018
https://issues.dlang.org/show_bug.cgi?id=5540

Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp

--
August 15, 2022
https://issues.dlang.org/show_bug.cgi?id=5540

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |MOVED

--- Comment #9 from RazvanN <razvan.nitu1305@gmail.com> ---
Walter is against adding warnings, so that path is a dead end.

These checks should be done by a linter that uses dmd as a library.

--