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

Mark constructors explicit #4

Merged
merged 1 commit into from
May 31, 2024
Merged

Conversation

sufferiing
Copy link
Member

@sufferiing sufferiing commented May 30, 2024

Marks the constructors for Quantity explicit to prevent code like this:

// all good
auto example(Length x, Angle y) {
    return x / y;
}

// BAD!
// values are implicitly converted into units via the constructor! could be very confusing
example(1, 2)

// GOOD
example(1_in, 2_deg)

from compiling with out specified units

@Aang099 Aang099 self-requested a review May 31, 2024 00:53
@Aang099 Aang099 merged commit ebb8aef into LemLib:main May 31, 2024
1 check passed
@sufferiing sufferiing deleted the explicit-constructors branch May 31, 2024 01:37
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 this pull request may close these issues.

2 participants