Always false float comparisons

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Tue May 10 23:27:24 PDT 2016


On 2016-05-10 23:44, Walter Bright wrote:
> On 5/9/2016 1:25 PM, Marco Leise wrote:
>> There is a whole bunch in this warning category:
>>   byte b;
>>   if (b == 1000) {}
>> "Comparison is always false: literal 1000 is not representable
>> as 'byte'"
>
> You're right, we may be opening a can of worms with this.

Scala gives a warning/error (don't remember which) for "isInstanceOf" 
where it can prove at compile time it will never be true. That has 
helped me a couple of times.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list