yank '>>>'?
Don
nospam at nospam.com
Sun Dec 6 11:21:02 PST 2009
Andrei Alexandrescu wrote:
> D has operator >>> which means "unsigned shift to the right", inherited
> from Java. But it doesn't need it because D has unsigned types, which
> can be used to effect unsigned shift. (Java, lacking unsigned types, had
> no other way around but to define a new operator.)
>
> Should we yank operator>>>?
>
>
> Andrei
Yes. It's an operation that doesn't make much sense -- it operates on
raw bits, not on integers. It's tied to a twos-complement
representation, and not to mathematics. If you ever try to implement >>>
for bigints, you find out how wierd it is.
I guess in the Java case, x>>>1 is cast(int)((cast(uint)x)>>1)
and there's no other way of doing it in a language which had no unsigned
types.
It had some merit before D had templates. Now, I don't think it has much
use.
More information about the Digitalmars-d
mailing list