[QGIS-Developer] cppcheck false positive

Even Rouault even.rouault at spatialys.com
Tue Sep 29 03:11:33 PDT 2020


On mardi 29 septembre 2020 11:55:40 CEST Alessandro Pasotti wrote:
> Looks like cppcheck is not smart enough...

Yeah, it hardly understands C++ (it doesn't need to be able to fully compile a file to analyze it, 
if I remember correctly)

> 
> const double factor { std::pow( 10, - mPrecisionSpinBox->value() ) };

I noticed this too. It is easily confused by curly initializer list, when used in a method body. It 
might also have sometimes issues with lambdas and variable scope.

> const double factor { std::pow( 10, - mPrecisionSpinBox->value() ) };

Using ( ) or = should fix it

const double factor (std::pow( 10, - mPrecisionSpinBox->value() ));
const double factor = std::pow( 10, - mPrecisionSpinBox->value() );

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200929/1db0861d/attachment.html>


More information about the QGIS-Developer mailing list