[問題] One problem from a header file

看板C_and_CPP (C/C++)作者 (gecer)時間8年前 (2017/12/09 12:02), 編輯推噓1(1010)
留言11則, 6人參與, 8年前最新討論串1/1
https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html from the link I saw a head foo.h #ifndef foo_h__ #define foo_h__ extern void foo(void); #endif // foo_h__ What is the usage of "foo_h__" here? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.121.28.242 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1512792123.A.212.html

12/09 12:07, 8年前 , 1F
header guard. if means if the header is not defined,
12/09 12:07, 1F

12/09 12:08, 8年前 , 2F
define it. That way, compiler saves time from go over
12/09 12:08, 2F

12/09 12:08, 8年前 , 3F
the same files. Another benefit is to make sure the no
12/09 12:08, 3F

12/09 12:08, 8年前 , 4F
two ambiguous, duplicate headers are being compiled.
12/09 12:08, 4F

12/09 12:42, 8年前 , 5F

12/10 07:40, 8年前 , 6F
樓上XDDDDDDDDDDDDD
12/10 07:40, 6F

12/11 08:26, 8年前 , 7F
怎麼覺得文法怪怪的
12/11 08:26, 7F

12/12 09:20, 8年前 , 8F
I saw a head.
12/12 09:20, 8F

12/12 21:00, 8年前 , 9F
A head was seen.
12/12 21:00, 9F

12/13 10:04, 8年前 , 10F
一樓寫得不錯阿 除了第一個if應該是it 沒什麼問題
12/13 10:04, 10F

12/13 10:06, 8年前 , 11F
@gecer: Have you taken formal programming courses
12/13 10:06, 11F
文章代碼(AID): #1QAs0x8I (C_and_CPP)
文章代碼(AID): #1QAs0x8I (C_and_CPP)