Local static variable table name

Why is the number appended to the local static variable name in the symbol table?

int main(void) {
    static stat_var = 20;

    return 0;
}

      

8: 0000000000000008 4 OBJECT LOCAL DEFAULT 2 stat_var .1604

+3


source to share


1 answer


There can be many local static variables with the same name (via different functions). The compiler gives them ambiguous suffixes to avoid potential name collisions.



+5


source







All Articles