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

fix(Return): remove [[nodiscard]] specifier on find_or_create_attribute(..) #1048

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

yo35
Copy link
Contributor

@yo35 yo35 commented Nov 21, 2024

It may be relevant to ignore the pointer returned by find_or_create_attribute(..) if the caller just wants to create the attribute (or to ensure it exists).

@@ -127,8 +127,8 @@ namespace geode
}

template < template < typename > class Attribute, typename T >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no likely to be accepted. Why do you need that?

You can use a workaround using either geode_unused function of [[maybe_unused]] keyword.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @BotellaA . Answer in main thread.

@yo35
Copy link
Contributor Author

yo35 commented Nov 21, 2024

I need that to create an attribute, but I don't need the pointer returned by the method. And there could be several reasons why I don't need it:

  • because the attribute that is created is constant,
  • because the creation and the modification of the attribute in the calling lib is not performed at the same place (e.g. the former in a sequential segment, the latter in a parallel segment),
  • etc...

More generally, in my opinion, [[nodiscard]] should not be applied to a method whose purpose is to change the state of one of its argument (i.e. to perform a side-effect operation).

@BotellaA BotellaA changed the base branch from master to next November 21, 2024 17:13
@BotellaA BotellaA merged commit 7798286 into Geode-solutions:next Nov 21, 2024
3 of 5 checks passed
@yo35
Copy link
Contributor Author

yo35 commented Nov 21, 2024

Thanks @BotellaA

@BotellaA
Copy link
Member

🎉 This PR is included in version 15.6.7-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@BotellaA
Copy link
Member

🎉 This PR is included in version 15.6.7 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants