cppcheck algorithm suggestions

Luboš Luňák l.lunak at collabora.com
Mon Jan 25 13:13:43 UTC 2021


On Saturday 23 of January 2021, Dr. David Alan Gilbert wrote:
> Hi,
>   What are peoples feelings for cppcheck's suggestions for stl algorithms?
> In https://gerrit.libreoffice.org/c/core/+/109846 I did a 'any_of'
> and a 'accumulate' that it suggested;  the any_of does look better,
> the accumulate seems marginally better.

 To me they both seem as a regression. I find the original code easily 
readable, I just look and see, while I need to "decypher" the std algo code.

> Does the project/people have general preferences on whether it's
> worth tackling these suggestions?
>
> I was less sure what to do with the suggestions for 'transform';
> some of them were replacing very simple loops; another
> was using emplace_back to add the results to the destination and I wasn't
> sure what I'd pass into transform for the equivalent.

 Suggestions from an automated tool are just that, suggestions. IMO common 
sense should be a higher priority than blindly following an automated tool.

-- 
 Luboš Luňák
 l.lunak at collabora.com


More information about the LibreOffice mailing list