C标准库中包含什么? [英] What is included in C Standard library?

查看:75
本文介绍了C标准库中包含什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将举一个的示例GNU C库文档:

13.1打开和关闭文件

13.1 Opening and Closing Files

本节介绍了用于打开和关闭文件的原语使用文件描述符.open和creat函数在以下位置声明头文件fcntl.h,而在unistd.h中声明了close.

This section describes the primitives for opening and closing files using file descriptors. The open and creat functions are declared in the header file fcntl.h, while close is declared in unistd.h.

我的问题是:

unistd.h fcntl.h 是否可以视为标准C?据我所知,它们应该是 Posix标准的一部分吗?

Can unistd.h and fcntl.h be considered as Standard C? As far as I know, they should be part of the Posix standard?

我们可以说C标准库= Posix函数+ C API吗?我很困惑,因为 C标准库的维基百科页面不包含 unistd.h ,但是GNU C库文档包括它吗?

Can we say C Standard Library = Posix functions + C API? I am confused because Wikipedia page for C Standard Library does not include unistd.h but the GNU C Library documentation includes it?

推荐答案

据我所见,在 C11 标准中,没有 unistd.h fcntl.h .因此,严格来说,它们不是 C 标准的一部分.

As far as I can see, in C11 standard, there is no unistd.h and fcntl.h. So, strictly speaking, they are not part of the C standard.

对于实现部分, GNU C库( glibc )是其中之一.在Wiki页面上

When it comes to the implementation part, the GNU C library (glibc) is one of them. From the wiki page

glibc 提供单一UNIX规范POSIX(1c,1d和1j)所需的功能,以及ISO C11,ISO C99,伯克利Unix(BSD)接口所需的某些功能,System V接口定义(SVID)和X/Open可移植性指南(XPG),第4.2版,以及与XSI(X/Open系统接口)兼容的系统的所有扩展,以及所有X/Open UNIX扩展.

glibc provides the functionality required by the Single UNIX Specification, POSIX (1c, 1d, and 1j) and some of the functionality required by ISO C11, ISO C99, Berkeley Unix (BSD) interfaces, the System V Interface Definition (SVID) and the X/Open Portability Guide (XPG), Issue 4.2, with all extensions common to XSI (X/Open System Interface) compliant systems along with all X/Open UNIX extensions.

此外, glibc 还提供了在开发GNU时被认为有用或必要的扩展.

In addition, glibc also provides extensions that have been deemed useful or necessary while developing GNU.

因此,作为POSIX标准的一部分,它们可以在 glibc 中使用.

So, as a part of the POSIX standard, they are available in glibc.

参考:检查 C11 标准 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆