Signed word lengths and indexes
Don
nospam at nospam.com
Thu Jun 17 13:52:26 PDT 2010
Walter Bright wrote:
> Steven Schveighoffer wrote:
>> On Thu, 17 Jun 2010 15:24:52 -0400, Don <nospam at nospam.com> wrote:
>>
>>>
>>> A question I have though is, Java has >>>. Does Java have these
>>> problems too?
>>
>> Java doesn't have unsigned values, so it's necessary to use regular
>> int's as bitmasks, hence the extra operator.
>
> The reason D has >>> is to cause an unsigned right shift to be generated
> without needing to resort to casts as one has to in C.
Unfortunately it doesn't work. You still can't do an unsigned right
shift of a signed byte by 1, without resorting to a cast.
> The problem with such casts is they wreck generic code.
It's C's cavalier approach to implicit conversions that wrecks generic
code. And it makes such a pigs breakfast of it that >>> doesn't quite work.
More information about the Digitalmars-d
mailing list