Linux 在哪里可以找到所有 C 标准库的源代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9672006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:08:06  来源:igfitidea点击:

Where can I find the source code for all the C standard libraries?

clinux

提问by

I'm looking for the whole source code of all the C standard libraries. That said, I'm looking for the source code of stdio.h, stdlib.h, string.h, math.h, etc... I would like to see how they were created. I think that it depends from platform to platform, but Linux or Windows one will be welcomed.

我正在寻找所有 C 标准库的完整源代码。也就是说,我正在寻找 stdio.h、stdlib.h、string.h、math.h 等的源代码......我想看看它们是如何创建的。我认为这取决于平台和平台,但 Linux 或 Windows 将受到欢迎。

采纳答案by Mike Sherrill 'Cat Recall'

PJ Plauger wrote a book about the standard C library. Includes references from the (now dated) standard, and source code.

PJ Plauger 写了一本关于标准 C 库。包括来自(现已过时的)标准和源代码的参考。

回答by Surya

Whether its installed with an IDE or you have installed explicitly, you have to look in the directory "Include" in respective location.

无论是使用 IDE 安装还是明确安装,您都必须Include在相应位置的目录“ ”中查找。

Ex: I use MinGW. So, I would go to

例如:我使用 MinGW。所以,我会去

c:/MinGW/includeto find those header files. Similarly, for an IDE (say Dev-cpp), you need to go to c:/dev-cpp/include.

c:/MinGW/include找到那些头文件。同样,对于 IDE(比如 Dev-cpp),您需要转到 c:/dev-cpp/include。

回答by AShelly

Microsoft Visual Studio generally has the system headers under <InstallDir>\VC\include, and the source, if installed, is under <InstallDir>\VC\crt\src.

Microsoft Visual Studio 通常<InstallDir>\VC\include<InstallDir>\VC\crt\src.

回答by Phil Miller

If you want the actual implementations, as everyone else has assumed you don't, many Linux distributions currently use glibcto implement the C standard library. Common alternatives include musl libc, diet libc, uClibc, and Bionic

如果你想要实际的实现,正如其他人假设你不想要的那样,许多 Linux 发行版目前使用glibc来实现 C 标准库。常见的替代品包括musl libc饮食 libcuClibcBionic