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

ES.23: change example code to better match the rule #2150

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

beinhaerter
Copy link
Contributor

The example suggests that int z = gsl::narrow_cast<int>(7.9);; is OK. The rule says "Use = only when you are sure that there can be no narrowing conversions.", which matches, but is also says "For built-in arithmetic types, use = only with auto.", and this is not respected here. So replace the one line with both possibilities suggested by the rule.

The example suggests that `int z = gsl::narrow_cast<int>(7.9);;` is OK. The rule says "Use `=` only when you are sure that there can be no narrowing conversions.", which matches, but is also says "For built-in arithmetic types, use `=` only with `auto`.", and this is not respected here. So replace the one line with both possibilities suggested by the rule.
@hsutter
Copy link
Contributor

hsutter commented Oct 12, 2023

Editors call: Looks good, thanks!

@hsutter hsutter merged commit 2d87c45 into isocpp:master Oct 12, 2023
1 check passed
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