Menu

clarifyCondition missed detection ?

2024-04-30
2024-05-01
  • Yannick HOUDOT

    Yannick HOUDOT - 2024-04-30

    void main ()
    {
    int a = 0;

    a = 0x0FF & ! 0x04;
    
    a &= ! 0x08;
    
    a |= ! 0x02;
    

    }


    $ cppcheck --version
    Cppcheck 2.13.0

    $ cppcheck --enable=all t.c --suppress=unreadVariable
    Checking t.c ...
    t.c:6:15: style: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
    a = 0x0FF & ! 0x04;
    ^
    nofile:0:0: information: Active checkers: 106/592 (use --checkers-report=<filename> to see details) [checkersReport]</filename>

    $

    only 1st issue is detected ... do you know of this miss-detection ?

     
  • CHR

    CHR - 2024-05-01

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

     

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.