[QGIS-Developer] cppcheck false positive

Alessandro Pasotti apasotti at gmail.com
Tue Sep 29 03:15:41 PDT 2020


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?


On Tue, Sep 29, 2020 at 12:11 PM Even Rouault
<even.rouault at spatialys.com> 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



-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it


More information about the QGIS-Developer mailing list