What is external linkage and internal linkage?

前端 未结 9 1221
情深已故
情深已故 2020-11-22 00:10

I want to understand the external linkage and internal linkage and their difference.

I also want to know the meaning of

const va

9条回答
  •  梦毁少年i
    2020-11-22 00:19

    In C++

    Any variable at file scope and that is not nested inside a class or function, is visible throughout all translation units in a program. This is called external linkage because at link time the name is visible to the linker everywhere, external to that translation unit.

    Global variables and ordinary functions have external linkage.

    Static object or function name at file scope is local to translation unit. That is called as Internal Linkage

    Linkage refers only to elements that have addresses at link/load time; thus, class declarations and local variables have no linkage.

提交回复
热议问题