Inline functions and external linkage

前端 未结 4 1269
太阳男子
太阳男子 2020-12-11 04:45

In this answer https://stackoverflow.com/a/4193698/738811 it\'s written that \"Inline functions by default have external linkage\". However it\'s not possible by default to

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 05:23

    Inline functions are typically "linkable" from other compile units. They won't appear as inline functions. There is a copy of the function in the compiled file. This applies to free inline functions. Class member functions do not, typically get a copy of the function for "non-inline" use. Good linkers will also remove the code as "dead code" if it's never rerferenced.

提交回复
热议问题