Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 22, 2018 [Issue 5714] case ranges in final switches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=5714 Dmitry Olshansky <dmitry.olsh@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |bootcamp CC| |dmitry.olsh@gmail.com -- |
August 09, 2020 [Issue 5714] case ranges in final switches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=5714 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=5713 -- |
December 17, 2022 [Issue 5714] case ranges in final switches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=5714 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P4 -- |
January 21, 2023 [Issue 5714] case ranges in final switches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=5714 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@geany.org --- Comment #4 from Nick Treleaven <nick@geany.org> --- (In reply to Andrej Mitrovic from comment #1) > And it also limits the number of cases to 256 (for optimization purposes?). > > So a final switch would only work on byte-types. See issue 15279 which seems to be an implementation issue rather than a design decision (the pull comment suggests lowering case range statements to an if/else instead). -- |
July 02 [Issue 5714] case ranges in final switches | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=5714 Bolpat <qs.il.paperinik@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |qs.il.paperinik@gmail.com --- Comment #5 from Bolpat <qs.il.paperinik@gmail.com> --- The limitation of the number of `case` labels is entirely orthogonal to allowing case ranges for `final switch`, as the ranges are just syntactic sugar for writing them out. This errors: --- void main() { ubyte u; final switch (u) { case 0: .. case 100: break; case 101: .. case 255: break; } } --- This is fine: --- void main() { ubyte u; Lswitch: final switch (u) { static foreach (i; 0 .. 100 + 1) { case i: break Lswitch; } static foreach (i; 101 .. 255 + 1) { case i: break Lswitch; } } } --- The error makes no sense. It might have made sense in 2011, but in 2024, it just requires some boilerplate to work. -- |
Copyright © 1999-2021 by the D Language Foundation