Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add a @mustuse function attribute #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

CompeyDev
Copy link

@CompeyDev CompeyDev commented Nov 29, 2024

This RFC proposes a @mustuse attribute, which may be applied to a function, enforcing the usage of a function's return value.

Rendered.

This RFC proposes a `@mustuse` attribute, which may be applied
to a function, enforcing the usage of a function's return
value.
@dv-extrarius
Copy link

I know it's used in several languages, but to me "mustuse" is sort of confusing - it sounds like you have to use the function. In C++ there is the gcc attribute warn_unused_result and the standard nodiscard (don't discard the return value or you get a warning), both of which seem better to me

@CompeyDev
Copy link
Author

I know it's used in several languages, but to me "mustuse" is sort of confusing - it sounds like you have to use the function. In C++ there is the gcc attribute warn_unused_result and the standard nodiscard (don't discard the return value or you get a warning), both of which seem better to me

I would also prefer @nodiscard on second thought, since @mustuse does initially feel like a dead code lint of sorts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants