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
Abuse of unreachable() #2571
Comments
I don't like the idea.
default:
*key_len = 0;
unreachable();
return NULL; We all must understand that in release neither Sorry for many words but I wanted to explain why:
|
As fourth point I would propose to hold where each of those instruments should be used in our C Style Guide. |
Fair enough. Feel free to submit a doc issue (or even PR). I totally agree with all points. |
unreachable() was added to help compiler determine that a branch can not be reached. Unfortunately, unreachable() in release builds is a noop, and it's being used in all cases when the programmer thinks that a branch is unreachable, not when it really is.
unreachable() should lead to panic() in production, otherwise it's a security time bomb.
The text was updated successfully, but these errors were encountered: