Menu

unassignedVariable FP

jacob s
2022-09-13
2022-09-13
  • jacob s

    jacob s - 2022-09-13

    hey,
    this code:

    int fun() {
        static int k;
        k++;
        return k;
    }
    

    gives:

    tmp.c:2:16: style: Variable 'k' is not assigned a value. [unassignedVariable]
        static int k;
                   ^
    tmp.c:1:0: style: The function 'fun' is never used. [unusedFunction]
    
    ^
    

    i don't think the unassignedVariable warning is correct.

    tested with latest main (07caf17eb3f2da73602f09c987139ef5a9c3f59f).

    thanks, jacob

     
  • CHR

    CHR - 2022-09-13

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

     

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.