Re: [問題] bss section為啥不占磁碟空間

看板C_and_CPP作者 ( 返無)時間12年前 (2012/03/27 13:25), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/3 (看更多)
http://descent-incoming.blogspot.com/2012/02/bss-section-1.html 這篇參考看看。 佔用多少 bss section 由 link 決定, 所以在 link 完成一個執行檔案後, bss section 的位址就會知道了, 而 c runtime library 會在 c 語言 main() 之前做好初使化 bss section, 就是填入 0。 在 linux 上, 可以參考下面這篇得到 bss section 的位址 http://descent-incoming.blogspot.com/2012/03/bss-section-2.html ※ 引述《QQ29 (我愛阿蓉)》之銘言: : 很抱歉~這問題不知道是否適合po在這 : 我再看 程式設計師的自我修養 第三章 : 他途中提到一句話 : "bss section是不占用磁碟空間" : 就此令我無法理解... : google的老半天 : 有幾篇文章 : 但他們好像也沒解釋得很清楚也直接下結論 : 請問各位該怎麼理解這句話 : static int x; : 至少他需要記錄bss section 需要占用 "多少"byte這個值吧 : "多少" 難道不用一起寫到elf檔案嗎? : 他是有提到"預留多少空間" 這個預留值再怎樣都要寫到elf檔案吧@@ : 請教各位 : 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.9.5.5

03/27 13:42, , 1F
簡單說,就是bss的大小並不記錄在bss中
03/27 13:42, 1F
※ 編輯: descent 來自: 1.162.100.249 (03/27 18:33)
文章代碼(AID): #1FSKzIws (C_and_CPP)
文章代碼(AID): #1FSKzIws (C_and_CPP)