[Issue 259] Comparing signed to unsigned does not generate an error
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 10 10:33:38 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=259
thomas.bockman at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |thomas.bockman at gmail.com
--- Comment #65 from thomas.bockman at gmail.com ---
(In reply to Andrei Alexandrescu from comment #64)
> We should be fine with a slight loss in efficiency in
> mixed sign compare.
The previously agreed upon solution was to default to
warning about each signed/unsigned comparison, but omit
the warning if VRP could prove it to be safe. There is
no loss of run-time efficiency that way, but some code
will break and require an explicit cast to fix.
Are you suggesting that we should just insert an extra
comparison to zero as needed, instead?
I'd support that, but I don't know how others
(including Walter Bright) would feel about it. The
real performance impact should be immeasurably small
in nearly all cases (especially with the VRP upgrades
discussed below).
> What active PRs are open at this time?
My DMD #5229 is a continuation of Lionello's work
toward improving VRP sufficiently to minimize code
breakage:
https://github.com/dlang/dmd/pull/5229
However, it's stuck pending a resolution to another
DMD bug:
https://issues.dlang.org/show_bug.cgi?id=15585
If #5229 ever gets pulled, one more tricky VRP-
related follow-up is required to make the compiler
smart enough. After that, actually fixing this bug
is trivial: I've had that patch ready to go for about
a year now, but can't submit it until the VRP stuff
is straightened out because it causes too much
breakage.
--
More information about the Digitalmars-d-bugs
mailing list