Skip to content
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

ES.48: to-crash-or-not-to-crash "Surprised? I’m just glad I didn’t crash the program." #2267

Open
andim2 opened this issue Mar 29, 2025 · 0 comments

Comments

@andim2
Copy link

andim2 commented Mar 29, 2025

((possibly a minor item - or maybe exactly not...))

That example likely firmly is UB (fully intentionally, of course, in this casting example).

Thus, wording
"Surprised? I’m just glad I didn’t crash the program."
possibly is exactly what one would NOT want to see written in such guidelines docs.

If an application is entering UB, then it possibly better should firmly/cleanly crash (full stop! Fail-Fast), in order to not proceed beyond (continue with!) now-tainted (corrupted) application state (within an application that might be up to life-or-death handling reliability severity level, yet now keeps spewing/furthering CORRUPTION, possibly even to persistence layers).

Related: E.26: If you can’t throw exceptions, consider failing fast

While desired behaviour (termination, continuation) may vary according to application reliability requirements, such a blanket statement better should not be mentioned.

So, "glad I didn't crash" probably insinuates a wrong/dangerous kind of thinking here, and if so should be usefully reworded or eliminated.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant