Modulo Bug?
bearophile
bearophileHUGS at lycos.com
Fri Sep 7 09:35:30 PDT 2012
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
More information about the Digitalmars-d
mailing list