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

Use newtype pattern to solve parameter mixup #1617

Open
2 tasks
elfenpiff opened this issue Sep 7, 2022 · 0 comments
Open
2 tasks

Use newtype pattern to solve parameter mixup #1617

elfenpiff opened this issue Sep 7, 2022 · 0 comments
Labels
globex refactoring Refactor code without adding features technical debt unclean code and design flaws
Milestone

Comments

@elfenpiff
Copy link
Contributor

elfenpiff commented Sep 7, 2022

Brief feature description

One can easily mix up seconds and nanoseconds in function arguments since the underlying type is the same. This can be fixed at compile time by using the newtype pattern and create two distinct non convertable types with the same properties as before.

Extracted from: #1196

  • In duration with seconds and nanoseconds
  • In SharedChunk while comparing raw pointers
@elfenpiff elfenpiff added refactoring Refactor code without adding features technical debt unclean code and design flaws globex labels Sep 7, 2022
@elfenpiff elfenpiff added this to the Low prio milestone Sep 7, 2022
@elfenpiff elfenpiff changed the title Seconds_t/Nanoseconds_t in duration should use newtype pattern to solve parameter mixup Use newtype pattern to solve parameter mixup Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
globex refactoring Refactor code without adding features technical debt unclean code and design flaws
Projects
Status: To do
Development

No branches or pull requests

1 participant