Babelz / SaNi

2D game engine with a twist.
MIT License
6 stars 2 forks source link

Add CPPCheck #9

Open failattu opened 9 years ago

failattu commented 9 years ago

Knowing you probably are using Jenkins you could easily add static code analysis with CPPCheck to your code.

Visualizations: https://wiki.jenkins-ci.org/display/JENKINS/Cppcheck+Plugin

CPP: http://cppcheck.sourceforge.net/

With all checks enabled I got the following performance results:

failattu commented 9 years ago

error id="functionStatic" severity="performance" msg="Technically the member function 'EventMath::add' can be static." verbose="The member function 'EventMath::add' can be made a static function. Making a function static can bring a performance benefit since no 'this' instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">

    </error>
    error id="functionStatic" severity="performance" msg="Technically the member function &apos;EventMath::sub&apos; can be static." verbose="The member function &apos;EventMath::sub&apos; can be made a static function. Making a function static can bring a performance benefit since no &apos;this&apos; instance is passed to the function. This change should not cause compiler errors but it does not necessarily make sense conceptually. Think about your design and the task of the function first - is it a function that must not access members of class instances?" inconclusive="true">
        <location file="{workspace}SaNi\tests\events\eventmath.h" line="22"/>
    </error>
siquel commented 9 years ago

We will look into this, thank you. After getting virtual box up and running.