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

Fix warning C4018: '<=': signed/unsigned mismatch #1908

Merged
merged 2 commits into from
Oct 2, 2020

Conversation

heckad
Copy link
Contributor

@heckad heckad commented Oct 1, 2020

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

fmt\include\fmt/format-inl.h(1797): warning C4018: '<=': signed/unsigned mismatch

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

@@ -1790,8 +1790,8 @@ bool check_divisibility_and_divide_by_pow5(uint32_t& n) FMT_NOEXCEPT {
template <int N> uint32_t small_division_by_pow10(uint32_t n) FMT_NOEXCEPT {
static constexpr struct {
uint32_t magic_number;
int shift_amount;
int divisor_times_10;
uint32_t shift_amount;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? The warning only refers to divisor_times_10.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can shift_amount be less then 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No but if this doesn't cause a warning, please keep it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any guarantees that it won't give out in the future?

@vitaut vitaut merged commit a581e9e into fmtlib:master Oct 2, 2020
@heckad heckad deleted the patch-1 branch November 2, 2020 22:40
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