On Thursday, 17 March 2016 at 09:59:41 UTC, Dominikus Dittes Scherkl wrote:
Or you can use an improved opCmp implementation in the compiler, that only add additional runtime cost, if someone is stupid enough to compare signed with unsigned values - but yield the correct result:

For the signed/unsigned comparison problem, specifically - I agree that would be the best solution (and is what D should have done originally). There's nothing "stupid" about doing mixed comparisons correctly, either - I doubt the performance hit would even be measurable in most code.

(`checkedint` solves a lot of other problems; the 30% performance hit does *not* come from properly handling signed/unsigned comparisons. A library-level wrapper that only fixed that one problem, and none of the others, could be super fast with proper optimizations.)

However, Walter and Andrei already decided that we should just have a warning for unsafe comparisons, instead. Just trying to get the warning implemented has dragged on for years already, so I'm not anxious to go back to square one by arguing for a different solution entirely...

Reply via email to