cppcheck results

Started by
4 comments, last by WitchLord 12 years, 2 months ago
Hi Andreas,

I've decided to run cppcheck ( http://sourceforge.net/projects/cppcheck ) 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.
Advertisement
I didn't know of cppcheck before, thanks for the tip. I'll take a look at the output.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

sure, np! please, let us know if you find anything important there :)
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

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.
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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement