C系统头文件说明

发布于 2024-11-30 18:56:27 字数 231 浏览 2 评论 0原文

这可能是一个荒谬的问题,但对我来说似乎是一个合理的问题......我经常打开源文件并看到其中包含的各种系统头文件,并想知道它们各自是什么。我知道 stdio.hsys\types.h 等文件的用途,但还有其他一些我不太确定。是否有地方提供标准头文件列表及其用途的描述(以及每个操作系统、语言标准给出的详细信息)?也许这个列表还包括所述头文件、宏等中包含的定义。按主题组织的内容也会有所帮助。

This may be a ridiculous question, but it seems like a reasonable one to me... I often open up source files and see various system header files included and wonder what each of them are. I know what the likes of stdio.h and sys\types.h are for, but there are others that I'm not too sure about. Is there someplace that gives a list of standard header files and a description of their purpose (and details given per OS, language standard)? Maybe this list would also include definitions included in said header files, macros, etc. Something organised by topic would be helpful, too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

摘星┃星的人 2024-12-07 18:56:27

对于语言定义的标头,C 标准 (PDF) 是权威的。尽管 5.2.4.2 中描述了 ,但每个标头都有一个小节。

POSIX 位于此处;访问是免费的,但您必须注册一个帐户。 (实际上,我并不是 100% 确定 POSIX、SUS 和 IEEE Std 1003.1 之间的关系。)

编辑:

Mac OSX 手册页可用 此处

但请考虑一下您可能是从错误的方向来处理这个问题的。编写代码时,更好的方法通常是 (a) 决定您想要做什么,(b) 找到一个可以执行该操作的函数,以及 (c) 阅读该函数的文档以确定您需要使用哪个标头 #包括。给定的标头不一定具有连贯的含义。

For language-defined headers, the library section (section 7) of the C standard (PDF) is definitive. There's a subsection for each header, though <limits.h> and <float.h> are described in 5.2.4.2.

POSIX is here; access is free, but you have to sign up for an account. (I'm actually not 100% sure of the relationship among POSIX, SUS, and IEEE Std 1003.1.)

EDIT :

Mac OSX man pages are available here.

But consider that you might be approaching this from the wrong direction. When writing code, a better approach is typically to (a) decide what you want to do, (b) find a function that will do it, and (c) read the function's documentation to determine which header you need to #include. A given header doesn't necessarily have a coherent meaning.

过去的过去 2024-12-07 18:56:27

希望这符合您正在寻找的内容:

http://en.wikipedia.org/wiki/ C_standard_library

Hopefully this is along th lines of what you were looking for:

http://en.wikipedia.org/wiki/C_standard_library

天邊彩虹 2024-12-07 18:56:27

一种方法是查看头文件内部。许多文件都有很好的注释。在 unix 系统下,您可以使用联机帮助页:man stdint.h pa

One way is to look inside the header file. Many files have good comments. Under unix systems you could use the manpage: man stdint.h p.a.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文