This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Adapting switch(x){case(y):...} with hashing
- To: GCC general mailing list <gcc at gcc dot gnu dot org>
- Subject: Adapting switch(x){case(y):...} with hashing
- From: Andy Walker <jawalker at stl dot quik dot com>
- Date: Fri, 01 Dec 2000 01:21:25 -0600
One of the obscure to-do list entries had an interesting request.
Currently, g++ uses a binary-tree / jump-table solution to handle
"switch"-"case" processing. The request was for hashing to be added as
an alternative when it would be appropriate (the note suggested sparse
sets). Obviously, the problem is more complex than it appears, and
binary searches have their strengths. Also, memory requirements may be
critically fatal.
Is anyone working on this? If not, would anyone like to engage in a
little discussion before I waste a lot of time on something *really*
stupid (in the hope that I learn about it before, rather than after
coding and testing :-P).
It just really ticks me off every time I use my debugger at work. I use
it on compiled C++ output from a well-known commercial vendor, and I
have to sequentially step through every "case" statement to reach the
one it should have used in the first place (obviously, they did not use
binary searches, either.) There is probably a good reason for that
behavior, and I will know it after trying to code it However, it
makes no sense to me right now.
Your critical comments are invited.
Andy