• Advertisement
Sign in to follow this  

cppcheck results

This topic is 2139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Andreas,

I've decided to run cppcheck ( [url="http://sourceforge.net/projects/cppcheck"]http://sourceforge.net/projects/cppcheck[/url] ) on the latest angelscript version (rev 1237). As always with automated checking, some of the items found are probably bogus, some totally legit. Hope you will find this useful.

Share this post


Link to post
Share on other sites
Advertisement
I verified each of the warning messages that cppcheck generated, and I'm happy to point out that none of them are pointing to an error in AngelScript. They are just warnings because I do not adhere to the coding style cppcheck is expecting.

There also seems to be a bug in cppcheck in that it doesn't understand compound assignments. There are a couple of warning messages where it warns that a variable is initialized with a value that is never used, but then the same variable is used in a += assignment so the value is definitely used.

Still, I'll download cppcheck myself to see if I can incorporate it into my own day to day work. If there is a way to disable warnings that I've already validated then the tool would be extremely valuable to catch mistakes in new code. If there is no such way, then the tool would just cause more work as I would have to validate the same warnings over and over again.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Well, it's nice to know we're on the safe side anyway. Although I must confess some of those 'member variable is not initialized in the constructor' warnings did look suspicious.

Share this post


Link to post
Share on other sites
Yes I can understand that, and cppcheck is right to warn about it as it cannot guarantee that the variables will be initialized before they are used. But as the same instance of these classes are reused multiple times I have another method for initializing the variables, and initializing them in the constructor too would just be double work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement