Hacker News new | ask | show | jobs
by listeria 138 days ago
may I introduce you to the nodiscard attribute[1]?

  enum (class)? [[nodiscard]] Error {
    Ok,
    NoMem,
    ...
  };
[1]: https://en.cppreference.com/w/cpp/language/attributes/nodisc...
1 comments

FWIW I’ve been using warn_unused_result in both gcc and clang since about 2020.
Yep, partial remedies are available for quite some time.