-
Notifications
You must be signed in to change notification settings - Fork 37
fix: fix build warning in switch case (#118) #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
can we do like below to avoid default in switch case? switch () {
...
}
+ Unreachable(); |
If there is no break statement in a certain case, the program may execute the Unreachable() function, which is not what we want (what we want is for each case to handle the situation and then exit, so we must be careful with the break statements). Additionally, when the compiler does not support exhaustive checking, we cannot know at compile - time if there are any missing cases. Of course, if it is indeed placed later, I can also make modifications. |
Which way do you think is better?
or
|
Isn't all this pattern in this case is |
Okay. If you’re sure it will cause an error, then I’ll modify it to put it outside. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for fixing this @MisterRaindrop
fix some compilation warnings. see issue (#118)