Where are static variables stored in C and C++?

前端 未结 16 2601
自闭症患者
自闭症患者 2020-11-22 02:00

In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don\'t have name collision? For example:


foo.c:                  


        
16条回答
  •  生来不讨喜
    2020-11-22 02:30

    they're both going to be stored independently, however if you want to make it clear to other developers you might want to wrap them up in namespaces.

提交回复
热议问题