[Issue 6176] [TDPL] Cannot use string variables in case expressions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 19 11:25:43 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6176
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #2 from bearophile_hugs at eml.cc 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list