Jump to content
Sign in to follow this  
bongo

possible compiler error with switch statements

Recommended Posts

hi pavel

i think there is something wrong with the interpretation of the switch/case/default statement.

when using a single switch/case/default statement, this seems to work, so that the default section is only executed, if no case condition is matching.

...but when there is a case section, containing another switch/case/default statement, this lower order switch/case/default seems not to work properly:

after a 'break' in a case section, the program seems not to proceed at the end of the whole switch/case/default construct. it simply goes to the next 'case'...and to the next 'case', and at the end to the 'default'. i.e. the default section is also executed, if a case section has been executed before.

i think this must be a bug ;-(

(yes, i have a 'break' at the end of each case section)

using a multiple if/then/else construct solved the problem for me, but looks not very nice. so i would be glad if you could check this anyway.

thanx!

tino

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...