Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by listeria

7 hours 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...

2 comments

listeria

Reply

drysine  7 hours ago

   C attribute: nodiscard (since C23)

[1] https://en.cppreference.com/w/c/language/attributes/nodiscar...

  • senderista  1 hour ago

    FWIW I’ve been using warn_unused_result in both gcc and clang since about 2020.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities