Signed word lengths and indexes
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Jun 17 09:11:38 PDT 2010
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 agree. But even within the current language, value range propagation
(VRP) should disallow this case without a problem.
There's been a long discussion about computing the bounds of a & b and a
|| b given the bounds of a and b. The current VRP code for those
operations is broken, and I suspect the VRP code for a >>> b is broken too.
Andrei
More information about the Digitalmars-d
mailing list