https://issues.dlang.org/show_bug.cgi?id=259

--- Comment #71 from [email protected] ---
(In reply to Manuel König from comment #69)
> Not sure how to deal with the slower comparisons like long-unsigned
> that have no direct assembly comparison instruction, maybe just
> produce an error message.

Speed is not the issue. The performance cost of a correct signed-unsigned
comparison is almost nothing (less than the cost of a single branch mispredict,
I believe), and in those very rare cases where the tiny speed boost of doing
the comparison incorrectly is really worth it, it is trivial to cast one of the
operands to the type of the other.

The real problem is that the current strange behaviour of mixed comparisons is
occasionally deliberately used in correct code. D must not be updated in a way
that silently breaks all that pre-existing correct code. Hence, a warning (or
at least, a *long* deprecation period) is the only good option for D2.

Introducing such a warning without drowning people in false positives is
surprisingly complicated, and is currently stalled waiting for a chain of
compiler changes to be completed:
    https://github.com/dlang/dmd/pull/12311
    https://github.com/dlang/dmd/pull/5229
    https://github.com/dlang/dmd/pull/1913

--

Reply via email to