Question 15
Back to Exercise
What does [[nodiscard]] on a function do?
- A Prevents the function from being called
- B Makes the compiler warn when the caller ignores the return value Correct
- C Deletes the return value
- D Makes the function noexcept
Correct Answer: Option B
It is ideal for functions returning error codes or newly created resources that must not be thrown away.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!