K
Kai-Uwe Bux
Leigh said:-1/2 == -1 is retarded.
Why?
E.g., say you want to implement a circular buffer, it would sure come in
handy just to code a shift of the current location by an arbitrary
displacement as
index = ( index + shift ) % size;
where shift could be negative. If % can yield negative results, one would
have to use more words unless, of course, the standard abandons the
invariant:
(a/b) * b + (a%b) == a
(which it won't).
What is a bit unfortunate is that the rules for / and % were implementation
defined for negative arguments. At least that is going to change. However, I
cannot see that the (not chosen) convention to have the remainder always be
positive is "retarded". I do not even see that it has a clear-cut advantage.
Could you provide a few?
Best
Kai-Uwe Bux