Skip to content

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

Closed
@andim2

Description

@andim2

((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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions