[Issue 259] Comparing signed to unsigned does not generate an error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 10 09:46:01 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=259
--- Comment #46 from Andrei Alexandrescu <andrei at erdani.com> 2013-04-10 09:45:57 PDT ---
(In reply to comment #45)
> uint b;
> if (b > -2) { ... }
>
> The integral expression -2 doesn't have any size per se, but whole size thing
> shouldn't even apply here, since the two expressions have ranges that are
> completely disjoint. Points 2 and 3 won't catch this case either and would
> cause an error. We could consider all integrals 'long' and apply point 1. Or,
> test for disjoint ranges and replace the whole comparison with a constant? (I
> have a feeling this optimization might already be happening in a later pass?)
I'd say we need to make this an error. If we don't (i.e. make the comparison
always true), then we'd silently change behavior.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list