This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

switch question to the support group

this really is a question for the support group, but, since the answer should be of general interst I ask it here.

By what algorithm are the cases of a switch statement searched?

if it is 'order of appearnce', some gains coulod be achieved by a 'popularity sequencing'

Happy new year and thanks for the old to all

Erik

Parents Reply Children
  • This article points out that if the case labels happen to be in order and sequential, you will get a jump table.

    That is TOTAL BULLSHIT!! You will NOT "get a jump table" unless you screw up your debugging by optimizing.

    It is not what it should be which is a function of the compiler, it has been move to the optimizer instead of keeping it where it belongs, the compiler. I can see no other reason to make this an optimizer feature than to move stuff from the compilere to the optimizer, just to make the optimizer look better.

    Erik