Tag: [[nodiscard]]

C++20 [[nodiscard]] Attribute

Written by on January 17, 2021 in C++, Programming with 0 Comments
C++20 [[nodiscard]] Attribute

[[nodiscard]] attribute “encourages” the compiler to issue a warning when the return value from a function is ignored. It was introduced in C++ 17 and enhanced in C++ 20 to include a string literal that can be used as an explanation of the warning. Let us look at different cases one by one. Case-1: An enumeration […]

Continue Reading

Top