Signed word lengths and indexes
KennyTM~
kennytm at gmail.com
Thu Jun 17 05:17:17 PDT 2010
On Jun 17, 10 18:59, Don wrote:
> Kagamin wrote:
>> Don Wrote:
>>
>>> (D has introduced ANOTHER instance of this with the ridiculous >>>
>>> operator.
>>> byte b = -1;
>>> byte c = b >>> 1;
>>> Guess what c is!
>>> )
>>
>> :)
>> Well, there was issue. Wasn't it fixed?
>
> No. It's a design flaw, not a bug. I think it could only be fixed by
> disallowing that code, or creating a special rule to make that code do
> what you expect. A better solution would be to drop >>>.
>
I disagree. The flaw is whether x should be promoted to
CommonType!(typeof(x), int), given that the range of typeof(x >>> y)
should never exceed the range of typeof(x), no matter what value y is.
>> More interesting case is
>> byte c = -1 >>> 1;
More information about the Digitalmars-d
mailing list