Adapting switch(x){case(y):...} with hashing
Robert Dewar
dewar@gnat.com
Fri Dec 1 07:11:00 GMT 2000
<<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.
More information about the Gcc
mailing list