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

Switch from C-style enums to C++ scoped enums #1025

Open
vyasr opened this issue Oct 12, 2022 · 1 comment
Open

Switch from C-style enums to C++ scoped enums #1025

vyasr opened this issue Oct 12, 2022 · 1 comment
Labels
task A task to be completed.

Comments

@vyasr
Copy link
Collaborator

vyasr commented Oct 12, 2022

Description

It would be nice to change all uses of enum in freud to enum class.

Motivation and Context

Scoped enums are generally preferred to C-style enums since they avoid polluting scopes and leaking dependencies, and they do not implicitly convert to integers.

Note that Cython requires 3.0 for full support for scoped enums, but we can still transition our C++ code to use them and then our Cython code will automatically get fixed whenever we updated to 3.0.

@vyasr vyasr added the task A task to be completed. label Oct 12, 2022
@tommy-waltmann
Copy link
Collaborator

I think this is worth waiting to address until we require Cython>=3.0 as a dependency. I've played around with this a bit and even just converting the cpp enums requires more work than you'd expect to get the bindings to work properly without cython natively supporting scoped enums.

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

No branches or pull requests

2 participants