digitalmars.D.bugs - [Issue 5528] New: Some integer interval analysis to avoid some casts
- d-bugmail puremagic.com (30/30) Feb 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5528
- d-bugmail puremagic.com (12/12) Jun 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5528
http://d.puremagic.com/issues/show_bug.cgi?id=5528
Summary: Some integer interval analysis to avoid some casts
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
This little D2 program shows code that's correct:
void main() {
uint i = 10;
ubyte x1 = i % ubyte.max;
ulong l = 10;
uint x2 = l % uint.max;
}
But dmd 2.051 asks for casts:
test.d(3): Error: cannot implicitly convert expression (i % 255u) of type uint
to ubyte
test.d(5): Error: cannot implicitly convert expression (l % 4294967295LU) of
type ulong to uint
I think those casts are not necessary, so I'd like dmd to avoid asking for
casts in such situations.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5528
yebblies <yebblies gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |yebblies gmail.com
Resolution| |DUPLICATE
*** This issue has been marked as a duplicate of issue 3147 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 16 2011








d-bugmail puremagic.com