存储声明符
在变量的定义或声明中,存储声明符控制了变量的两个属性:1. 存储期(storage duration) 2. linkage
存储声明符有:
- auto----automic storage duration
- register----automic storage duration,storage in register
- static ----static or thread storage duration and internal linkage
- extern ----static or thread storage duration and external linkage
- thread_local ---- thread storage duration
linkage
no linkage(search from this scope)
- 在block scope里,没有声明extern 和 static
- local class and 他们的成员函数
internal linkage(search from current translation unit)
- variable or function 被声明为static
- 没有被声明为extern 的const变量
- 匿名union 的成员变量
external linkage(search from all translation unit or other language)
- 有名字namespace的变量
- block scope中,有extern 变量
- names of functions