I am looking for the best way to avoid cppcoreguidelines-init-variables
warnings with clang-tidy
.
std::istringstream in(line);
float x, y, z, rotx, roty, rotz;
in >> x >> y >> z >> rotx >> roty >> rotz;
-> variable 'x' is not initialized, variable 'y' is not initialized, ...
double min_intensity, max_intensity;
cv::Point point_min, point_max;
cv::minMaxLoc(input, &min_intensity, &max_intensity, &point_min, &point_max, elliptic_mask_around_center);
-> variable 'min_intensity' is not initialized, ...
I could assign a value for x
, y
, ... and min_intensity
and max_intensity
, but I do not see why I should do it.
What would be the best way to avoid this warning?
float x = 0.F; // initialize to a value, but 6 lines, and it makes no sense because x is never 0
float x = NAN; // works but 6 lines, and needs <cmath> inclusion
float x, y, z, rotx, roty, rotz; // NOLINT [not very practical, and means the warning is a false positive]
Thank you for your help.