Menu

FP with alternative token 'not'

2020-04-22
2020-04-23
  • Paul Cornett

    Paul Cornett - 2020-04-22

    It seems like 'not' isn't getting recognized here. Tricky to reproduce, it has to be in a const member function.

    struct C {
        void f(int i) const
        {
            bool done = false;
            if (i == 0)
                done = true;
            if (not done) { }
        }
    };
    

    t.cpp:4:8: style: The scope of the variable 'done' can be reduced. [variableScope]
    t.cpp:4:13: style: Variable 'done' is assigned a value that is never used. [unreadVariable]
    t.cpp:6:9: style: Variable 'done' is assigned a value that is never used. [unreadVariable]

     
  • Daniel Marjamäki

    Thank you! I have created ticket https://trac.cppcheck.net/ticket/9689

     

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.