Everywhere?!
Explore the purpose and practical use of the [[nodiscard]] attribute introduced in C++17 and expanded in C++20. Understand why ignoring return values can cause serious issues like resource leaks and how [[nodiscard]] helps enforce safer coding practices. Learn when to apply it, especially for error codes and factory functions, and discover alternative approaches for improving code correctness.
We'll cover the following...
We'll cover the following...
There’s a paper that might be a “guide” P0600R0 - [[nodiscard]] in the Library.
The proposal didn’t make into C++17 but was voted into C++20. It suggests a few places were the attribute should be applied. ...