[問題] static + extern
問題(Question):
我是無意間看到
http://www.tenouk.com/ModuleZ.html
裏面提到:
Static storage class can be specified for automatic as well as external
variables such as:
static extern varx;
可是我無法理解static怎麼會跟extern合用。
extern是表示該變數被定義在所在的frame以外要另外去找
static是表示該變數被侷限在所在的frame以內
合用意味著?所以在哪些情況下需要合用?
static auto 似乎比較好理解,兩者都是把變數侷限(這樣好像多此一舉?)
不知道有無這種需要兩種以上keyword定義variable的情況?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.32.244.234
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1448803181.A.932.html
推
11/29 21:42, , 1F
11/29 21:42, 1F
→
11/29 21:44, , 2F
11/29 21:44, 2F
→
11/29 21:44, , 3F
11/29 21:44, 3F
→
11/29 21:45, , 4F
11/29 21:45, 4F
→
11/29 21:48, , 5F
11/29 21:48, 5F
→
11/29 21:48, , 6F
11/29 21:48, 6F
→
11/29 21:49, , 7F
11/29 21:49, 7F
→
11/29 21:50, , 8F
11/29 21:50, 8F
→
11/29 21:50, , 9F
11/29 21:50, 9F
→
11/29 22:34, , 10F
11/29 22:34, 10F
→
11/29 22:57, , 11F
11/29 22:57, 11F
→
11/29 23:39, , 12F
11/29 23:39, 12F
推
11/30 13:43, , 13F
11/30 13:43, 13F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章