On mardi 29 septembre 2020 12:15:41 CEST Alessandro Pasotti wrote:
> Hi Even,
> 
> Thank you, I knew how to fix it but I was wondering if it is possible
> to reduce the false positives (see my other thread about spellchek on
> testdata), life is too short to be wasted in fighting with a dumb
> software :)
> Maybe a more recent version of cppcheck does nor have this issue?

I'm afraid not. my latest attempts with recent cppcheck HEAD lead to number of  
new false 
positives on GDAL that weren't reported before.
The cppcheck version of ubuntu18.04 is not so bad actually.

When things go bad you can add a suppression

// cppcheck-suppress {name_of_cppcheck_diagnostic}

Or we can disable a category in scripts/cppcheck.sh if it is too unreliable

Even

> 
> 
> On Tue, Sep 29, 2020 at 12:11 PM Even Rouault
> 
> <[email protected]> wrote:
> > 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


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to