← Friday, October 16, 2026Languages & toolsGuide
C23 conventions use [[nodiscard]] to catch ignored drawing results
One convention marks drawing functions [[nodiscard]] because callers need the returned rectangle for later logic, while allowing explicit handling when the value is unused. It’s a practical example of using newer C features to prevent bugs in a maintained project.
- What
- - A C23 convention uses [[nodiscard]] for drawing functions whose returned rectangle callers should inspect.
- How
- - [[maybe_unused]] lets callers intentionally retain and ignore a result without triggering unused-variable errors.
- Why it matters
- - These annotations help engineers catch business-logic mistakes while keeping intentional exceptions explicit.
Read on abner.page → Lobsters · 9 comments
Discussion
Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.
Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.