[QGIS-Developer] cppcheck false positive

Alessandro Pasotti apasotti at gmail.com
Tue Sep 29 04:07:26 PDT 2020


On Tue, Sep 29, 2020 at 12:57 PM Denis Rouzaud <denis.rouzaud at gmail.com> wrote:
>
> Side question, is there a technical reason to prefer this syntax over the = one?
>
> The = is more readable to me, but that's a matter of experience I guess.
> More generally, it would be nice to decide for one syntax and have a coherence over the source code.
>
> Cheers,
> Denis
>

Hi Denis,

I agree about the need for coherence, we currently have a mix of = ()
and {} initialization.

I'm not such an expert to tell you which is the best, but I've found
this explanations quite convincing:

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es23-prefer-the--initializer-syntax
https://stackoverflow.com/questions/18222926/why-is-list-initialization-using-curly-braces-better-than-the-alternatives

That is the reason why I switched to {} as my preferred method.

Cheers

> Le mar. 29 sept. 2020 à 11:55, Alessandro Pasotti <apasotti at gmail.com> a écrit :
>>
>> Looks like cppcheck is not smart enough...
>>
>> const double factor { std::pow( 10, - mPrecisionSpinBox->value() ) };
>>
>> https://github.com/qgis/QGIS/pull/39079/checks?check_run_id=1181360827#step:4:1693
>>
>> --
>> Alessandro Pasotti
>> QCooperative:  www.qcooperative.net
>> ItOpen:   www.itopen.it
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



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


More information about the QGIS-Developer mailing list