作者gecer (gecer)
看板C_and_CPP
标题[问题] One problem from a header file
时间Sat Dec 9 12:01:59 2017
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://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1512792123.A.212.html
1F:→ wawi2: header guard. if means if the header is not defined, 12/09 12:07
2F:→ wawi2: define it. That way, compiler saves time from go over 12/09 12:08
3F:→ wawi2: the same files. Another benefit is to make sure the no 12/09 12:08
4F:→ wawi2: two ambiguous, duplicate headers are being compiled. 12/09 12:08
6F:推 Ommm5566: 楼上XDDDDDDDDDDDDD 12/10 07:40
7F:→ jack1218: 怎麽觉得文法怪怪的 12/11 08:26
8F:→ MOONRAKER: I saw a head. 12/12 09:20
9F:→ CoNsTaR: A head was seen. 12/12 21:00
10F:→ MOONRAKER: 一楼写得不错阿 除了第一个if应该是it 没什麽问题 12/13 10:04
11F:→ MOONRAKER: @gecer: Have you taken formal programming courses 12/13 10:06