c++ - conversion from 'uint64_t' to 'unsigned int' -
for following function in microsoft visual studio 2015 rc, 2 warnings regarding comparison of signed , unsigned variables.
uint64_t findmin(vector<uint64_t> &v) { uint64_t min = 0; uint64_t s = v.size(); (uint64_t = 0; < s; ++i) { if (v[i] != 0) { // warning min = v[i]; // warning break; } } ... }
the warning is
warning c4244: 'argument': conversion 'uint64_t' 'unsigned int', possible loss of data
that weird because @ least sure min
, v[i]
both have uint64_t
variables , obvious.
is related rc edition? or there behind that unaware of that?
the "argument" compiler warning i
argument operator[]
in v[i]
(note argument on either of lines).
the parameter of operator[]
overload of type size_t
. in 32-bit builds size_t
32-bit unsigned integer. conversion of 64-bit unsigned i
32-bit unsigned parameter type narrowing conversion.
Comments
Post a Comment