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

Facilitate use of designated initializers for structs such as various Options #13293

Open
pdillinger opened this issue Jan 13, 2025 · 0 comments

Comments

@pdillinger
Copy link
Contributor

We have a number of P.O.D. Options structs that have unfortunate constructors with (positional) parameters that are easily used confusingly, as in ReadOptions{true, false}. Importantly, in C++20, the existence of this constructors interferes with use of the much healthier designated initializer syntax.

We should review our public APIs and deprecate these constructors, to promote better code hygiene. Along the same lines, we should avoid the pattern of describing default values in a comment, which could become out of sync with constructor code, and use default member initializers for defaults.

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

No branches or pull requests

1 participant