Menu

bug hunting usability

2020-05-06
2020-05-20
  • Daniel Marjamäki

    I am curious about how usable the bug hunting feature is so far.

    If you have used it. Do you have some opinions? Do you feel that it is too stupid to be useful? Did you try the function contracts in the GUI yet, if so how do you feel about those?

     
  • Steven Cook

    Steven Cook - 2020-05-20

    I've just tried cppcheck 2.0 for the first time and found bug hunting reports too many obvious false positives. This is in contrast to other checks that cppcheck is doing, which have got smarter in the 2.0 release (for example the knownArgument check).

    The best example I have is this code, for which cppcheck reports error (bughuntingDivByZeroFloat): There is division, cannot determine that there can't be a division by zero.

    const double stepSize( 1.0 ); 
    int numSteps = 1U + static_cast< unsigned int >( ( upperBound.GetX() - lowerBound.GetX() ) / stepSize ); 
    

    (Don't ask why the code is bothering to divide by 1.0, or why there is a weird mix of int and unsigned int, I have no idea!)

    I haven't tried using contracts yet but that seems like a really useful feature.

     

    Last edit: Steven Cook 2020-05-20
  • Daniel Marjamäki

    Thanks! I created https://trac.cppcheck.net/ticket/9733 for that false positive.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.