Skip to content

Conversation

LiangHuDream
Copy link

@esoft-com This warning occurs because on x86 Windows, size_t is a 32-bit unsigned integer, while unsigned __int64 is a 64-bit unsigned integer. Implicitly converting from unsigned __int64 to size_t can cause data loss, so MSVC emits warning C4244.
To resolve this, we should explicitly cast the value to size_t wherever the conversion happens, ideally at the point where the warning is triggered. thank you for checking the code

@LiangHuDream
Copy link
Author

@vitaut
This warning occurs because on x86 Windows, size_t is a 32-bit unsigned integer, while unsigned __int64 is a 64-bit unsigned integer. Implicitly converting from unsigned __int64 to size_t can cause data loss, so MSVC emits warning C4244.
To resolve this, we should explicitly cast the value to size_t wherever the conversion happens, ideally at the point where the warning is triggered. thank you for checking the code

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.

size += grouping.count_separators(exp);
return write_padded<Char, align::right>(
out, specs, to_unsigned(size), [&](iterator it) {
out, specs, to_unsigned(static_cast<size_t>(size)), [&](iterator it) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove to_unsigned since with the cast the argument is already unsigned.

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