Menu

Possible false positive warning in cppccheck 2.8

Marc Zim
2022-06-03
2022-06-03
  • Marc Zim

    Marc Zim - 2022-06-03

    Hello,

    I am facing a warning in cppcheck (new in 2.8) I don't understand, with attached file.cpp I get:

    new2.cpp:14:33: style: Condition 'std::min(apple,banana)!=-1' is always true [knownConditionTrueFalse]
    if (std::min(apple, banana) != -1) {

    From my point of view, the case apple=-1 and banana=2 makes this a false positive, but maybe I missed something.

    Thanks for helping me.

     
  • Marc Zim

    Marc Zim - 2022-06-03

    command line to reproduce the problem: cppcheck new2.cpp --enable=all

     
  • CHR

    CHR - 2022-06-03

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11124

     

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.