THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/10/2012 at 14:44, xxxxxxxx wrote:
Originally posted by xxxxxxxx
...What you might try is this tool (it's expensive if you plan buying it, but you can use the trial for without limitations of the functionality until you've "used" the a certain number of clicks on its output) : http://www.viva64.com/en/pvs-studio/
They do static code analysis of your source (which takes some time, if you haven't the fastest machine) and sometimes they are able to spot quite interesting bugs - you will also have to deal with false positives too (you've to check them all...), but that 's a part of static analysis...
OK, I downloaded the demo and ran it on my project:
... but as you can see the number of "Fails" is 0. About half of the warnings are from the api project code and the other half are from my code. There were warning levels 1, 2 and 3 in both the api project code and my code.
I also found an open source static code analysis application on source forge:
... downloaded that and ran a check on my source code:
... and it flagged 2 as errors while the rest were flagged as "Style" warnings. The 2 errors were accessing a class pointer's member functions before checking for a valid pointer, one was getting a BaseSelect, and the other was getting the calculated phong normals array (which I initially figured were guaranteed not to be NULL). But even after correcting those 2 errors, it still crashes when compiler optimization is enabled.
I did a little reading on the PVS Studio site about false positives regarding preprocessor #ifdef's, but I'm not sure if that applies. The only preprocessor directives I'm using that would affect R14 are:
#if API_VERSION < 12000
//compile this code
//compile this code
... and those seem to compile fine in previous versions.
One thing I did notice though is when the plugin is compiled with the optimization enabled and it crashes, the code under less than R12 directive is not grayed out, but when I compile it with the optimization disabled and add a break point in the source code, when it breaks, the code under less than R12 directive is grayed out. I'm not sure if that means anything or not.
So, what do I check now?