We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
Knowledgebase article:
http://www.keil.com/support/docs/1316.htm
This article points out that if the case labels happen to be in order and sequential, you will get a jump table. However, it doesn't give any clues as to what other factors influence the compiler, so it's not particularly helpful. You do know there are three possiblities for implementation and the decision is "complex", but that's it.
We had this thread back in July. http://www.keil.com/forum/docs/thread8020.asp
Good luck in extracting any more details from the dev team.
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.