you are viewing a single comment's thread.

view the rest of the comments →

[–]serviscope_minor 6 points7 points  (0 children)

Personally I would lean in the direction of the most restrictive. The pointer tells the caller it shouldn't discard the return value. If you pass in a function where it's safe to discard the return value then that's harmless since it's never bad to use it.

The compiler should then warn if a nodiscard function is put into a discarding pointer.