isocpp / isocpp/CppCoreGuidelines
I.10 "Use exceptions..." doesn't mention [[nodiscard]] alternative
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 45.3k
- Forks
- 5.6k
- PR merge metrics
- No merged PRs in 30d
Description
The reason as stated in I.10: Use exceptions to signal a failure to perform a required task is as follows:
Reason It should not be possible to ignore an error because that could leave the system or a computation in an undefined (or unexpected) state. This is a major source of errors.
There's another rule that satisfies the statement above, namely: Always use a type marked as [[nodiscard]] such as absl::Status or absl::StatusOr to signal a failure to perform a required task
Could you expand I.10 to explain why exceptions are preferable to this approach?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the I.10 rule in the C++ Core Guidelines and review its current Reason text alongside the issue's [[nodiscard]], absl::Status, and absl::StatusOr examples. Done means the guidance explains whether and why exceptions are preferable, or clarifies the conditions under which the alternatives satisfy the rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100