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

Upgrade to C++17 #34

Closed
lorenzo-gomez-windhover opened this issue Sep 4, 2024 · 0 comments · Fixed by #41
Closed

Upgrade to C++17 #34

lorenzo-gomez-windhover opened this issue Sep 4, 2024 · 0 comments · Fixed by #41

Comments

@lorenzo-gomez-windhover
Copy link
Collaborator

lorenzo-gomez-windhover commented Sep 4, 2024

std::optional, which is added in C++17, would allow to return "empty" values from functions in a concrete/explicit way and prevent us from using "sentinel" polymorphic variables, improving readability in the intent of code.

For example:

bool      Symbol::hasEncoding() { return encoding != -1; }

Can be converted to something like

std::optional<int>    Symbol::getEncoding() { encoding; }

and use a function like value_or to concretely express the intent without having the ambiguity of using a "-1" for "invalid"

Changes between C++14 and C++17

Compiler support for C++17

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

Successfully merging a pull request may close this issue.

1 participant