Skip to content

fix(msvc): silence C4244 in AddPowers and complexity pow (#826) - #2286

Open
jameswatsoncraft wants to merge 3 commits into
google:mainfrom
jameswatsoncraft:fix/msvc-w4244-826
Open

fix(msvc): silence C4244 in AddPowers and complexity pow (#826)#2286
jameswatsoncraft wants to merge 3 commits into
google:mainfrom
jameswatsoncraft:fix/msvc-w4244-826

Conversation

@jameswatsoncraft

Copy link
Copy Markdown

Summary

Fixes MSVC /W4 warnings called out in #826:

  • AddPowers: use vector<T>::difference_type instead of static_cast<int>(size_t) (C4244)
  • FittingCurve: cast IterationCount to double before std::pow (C4244)

CheckHandler already suppresses C4722 locally in check.h.

Fixes #826.

Test plan

  • Build with MSVC /W4 on touched TUs
  • Existing benchmark test suite

Signed-off-by: jameswatsoncraft <jameswatsoncraft@users.noreply.github.com>
Signed-off-by: jameswatsoncraft <jameswatsoncraft@users.noreply.github.com>
@google-cla

google-cla Bot commented Aug 12, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Comment thread src/benchmark_register.h Outdated

return dst->begin() + static_cast<int>(start_offset);
return dst->begin() +
static_cast<typename std::vector<T>::difference_type>(start_offset);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we just use size_t here? Typename stuff is so ugly.

Signed-off-by: jameswatsoncraft <jameswatsoncraft@users.noreply.github.com>
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.

Warnings C4244, C4305, C4722, ... when compiling with MS Visual Studio 2017 15.9.12

2 participants