Walter Bright:

Because then C code translated to D will have subtle, silent and unexpected bugs.

I agree. So the solution is to introduce a new Phobos function or new built-in operator that works more correctly with negative numbers too.

A new Phobos function named mod() is a very simple solution.

While a new infix operator has the advantage of being more natural to use, this allows programmers to better remember to use it instead of the C %, so the maybe a built-in operator avoids some bugs compared to the function.

Bye,
bearophile

Reply via email to