I suggest you ...

warn_unused_result attribute

Add the possibility to mark functions/methods with an attribute that creates a compiler warning if its result is unused by the caller.

This allows to write much cleaner and safer code.

Clang or GCC offer this possibility with the following attributes:

[[gnu::warn_unused_result]]

__attribute__((warn_unused_result))

22 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

4 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base