How are static variables with the same name in different functions identified by the System?

AFAIK, can we have two static variables with the same name in different functions? How are they controlled by the compiler and symbol table? How is their personality managed separately?

+3
source share
3 answers

Compilers do not store static variable names in the link symbol table. This is just part of the memory that is part of the module with respect to the linker. (this may not be 100% true in all cases, but it really is)

Names of static variables are usually included in the debug symbol table.

.c , , , . , /, ( ).

+3

, , , , .

dumpbin /symbols foo.obj, objdump Linux.

+1

, . , .

+1
source

Source: https://habr.com/ru/post/1743784/


All Articles