1 year ago
#290641
Jojolastiti
How to disable implicit conversion changes signedness warning in CMAKE
Does anybody know if there is a way to disable this kind of warning given by clang in CMAKE please ?
std::vector<float> v{1.f, 2.f, 1.f};
int i = 1;
float foo = v[i]; // Here we get the warning, variable i should be a size_t
...
Implicit conversion changes signedness: 'int' to 'std::__1::vector<float>::size_type' (aka 'unsigned long')
Clang compiler gives me a warning on v[i]
as it wants me to cast it as a size_t
which is quite verbose if I do explicit casting everywhere.
Also, I don't want to use size_t
. For me this type it is error prone as it breaks the standard substraction when getting negative results. (my vectors will never exceed 2^31 btw)
c++
unsigned
suppress-warnings
size-t
0 Answers
Your Answer