What is external linkage and internal linkage?

前端 未结 9 1204
情深已故
情深已故 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条回答
  •  情深已故
    2020-11-22 00:23

    Basically

    • extern linkage variable is visible in all files
    • internal linkage variable is visible in single file.

    Explain: const variables internally link by default unless otherwise declared as extern

    1. by default, global variable is external linkage
    2. but, const global variable is internal linkage
    3. extra, extern const global variable is external linkage

    A pretty good material about linkage in C++

    http://www.goldsborough.me/c/c++/linker/2016/03/30/19-34-25-internal_and_external_linkage_in_c++/

提交回复
热议问题