https://bugs.documentfoundation.org/show_bug.cgi?id=157664

            Bug ID: 157664
           Summary: Drop operator !=, where respective operator == is
                    defined
           Product: LibreOffice
           Version: 24.2.0.0 alpha0+ Master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: difficultyBeginner, easyHack, skillCpp
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

In C++20, operator != is auto-generated, when operator == is present. It means
that the explicit declaration/definition of operator != is useless; and in
cases where the definition is not a trivial call of negated operator ==, it is
also a maintenance burden - meaning that every time operator == is modified
(e.g., as a result of adding new members), the operator != needs a
corresponding change.

The codebase uses C++20 since commit 1eef07805021b7ca26a1a8894809b6d995747ba1.

This easyhack is about finding all operator != instances, and removing those
that have corresponding operator ==.

In some cases, there is no corresponding operator == - e.g., in case where the
operator != was added explicitly to enable use of the class in an algorithm. In
these cases, the class should not change.

In some cases, the removal of operator != would break code that explicitly
calls operator !=. In these cases, the calling code needs to be changed to call
operator ==, or something similar.

In some cases, such a removal can not compile, because of problems in
corresponding operator ==. E.g., such an operator can be non-const; and
automatically generated operator != is always const, so it can't use a
non-const operator ==. The compilation failures in this case could be cryptic.

This is an easyhack that can be worked on in parallel. Please don't do a
large-scale change over the whole codebase; only change one or two files at a
time. Do not assign this issue to you, because of the parallel nature of the
task.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to