Since C++20, a three-way comparison operator (a "spaceship" operator <=>) is available [1]. The codebase uses C++20 since commit 1eef07805021b7ca26a1a8894809b6d995747ba1. In cases where we have a full set of comparison operators, it could be beneficial to replace them all with such a three-way operator, to benefit from code deduplication. Indeed, this needs to take performance into account. In many cases, the implementation of the operator may also be simplified from something like > if (a < other.a) > ... > else if (a == other.a && b < other.b) > ... into more idiomatic > return std::tie(a, b) <=> std::tie(other.a, other.b); Sometimes there is no full set of comparison operators in a class, and only e.g. operator < is defined. In such cases, the three-way comparison would be unnecessary; but the simplification of the implementation comparing std::tie could still be used. When simplifying the implementations in such a way, performance needs to also be taken into account: e.g., some calculations should only be performed after previous comparisons were done, which would not happen, if everything would be passed to std::tie at once. 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. [1] https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison
could you recommend specific files or areas where changes might be particularly beneficial.
(In reply to t.aswath from comment #1) > could you recommend specific files or areas where changes might be > particularly beneficial. One of the tasks in easy hacks is to apply and grow your discovery skills, so can you please tell us how you tried to search for candidates so far?
RMZeroFour committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6227fccce44e7c44a7a6da707f361b1d4886c1d0 tdf#157665 Use <=> operator for errcode and strong_int It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.