What    |Removed                     |Added
                 CC|                            |

--- Comment #2 from 2011-06-19 11:20:58 PDT ---
(In reply to comment #1)

> Though I am made to wonder why this restriction is there.

The purposes of a switch are to give a ordered syntax to manage several value
cases (final switches are able to catch some bugs too), and to compile to
efficient code, sometimes a complex mix of dispatch tables and hard-coded
search trees (and more, if the compiler is smart, doing automatically one of
the purposes of computed gotos). I think currently DMD doesn't optimize string
switches a lot, but it's not hard to think about it using a hard-coded trie,
some kind of digital tree, perfect hashing, etc. Compile-time constants allow
to create such optimized code.

See also bug 5862

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to