[Issue 5714] New: case ranges in final switches
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 7 04:34:20 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5714
Summary: case ranges in final switches
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-03-07 04:31:23 PST ---
This is a low-priority enhancement suggestion.
If the type to final-switch on has a natural ordering (so it's not an enum!),
like a char/ubyte/byte, then in some situations I'd like to use the range
syntax:
void main() {
ubyte u;
final switch (u) {
case 0: .. case 100: break;
case 101: .. case 255: break;
}
}
Currently DMD 2.052 gives the errors:
test.d(4): Error: case ranges not allowed in final switch
test.d(5): Error: case ranges not allowed in final switch
See also bug 5713
If case ranges are not allowed on full-range int values, then you can't use
them in a final switch.
--
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