This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Adapting switch(x){case(y):...} with hashing
- To: gcc at gcc dot gnu dot org, jawalker at stl dot quik dot com
- Subject: Re: Adapting switch(x){case(y):...} with hashing
- From: dewar at gnat dot com (Robert Dewar)
- Date: Fri, 1 Dec 2000 10:11:26 -0500 (EST)
<<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.
>>
I don't see why there should be any conceptual problem in implementing
this approach. All BCPL compilers had this capability for example.