gpt4 book ai didi

c - 支持 strerrorlen_s 和 strerror_s 函数的最旧版本的 gcc/glibc 是什么?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:39:21 26 4
gpt4 key购买 nike

我在使用 strerrorlen_s 时遇到问题在 gcc 4.7.2 中,即使我定义了 __STDC_WANT_LIB_EXT1__ 1.

最佳答案

它不在 glib 2.13 中,至少在 Debian 下是这样,但我不明白为什么它会与任何其他系统不同。在整个磁盘上搜索 strerrorlen_s 不会返回任何结果。

它也没有在 2.14 到当前 2.17 的任何发行说明中列出(搜索 boundstr24731strerrorlen_s)。 2.18 wiki page 上什至没有提到它.

请记住,边界检查接口(interface)是 C11 的一个可选特性。附件 K 对此进行了详细说明,并且实现根本不需要提供它。

K.2 Scope:

1/ This annex specifies a series of optional extensions that can be useful in the mitigation of security vulnerabilities in programs, and comprise new functions, macros, and types declared or defined in existing standard headers.

2/ An implementation that defines __STDC_LIB_EXT1__ shall conform to the specifications in this annex. Implementations that do not define __STDC_LIB_EXT1__ are not required to conform to these specifications.

看起来实际上根本没有计划在核心 glibc 中支持此功能。来自 Ulrich Drepper(诚然是 2012 年 3 月)关于是否会提供支持的评论:

Even the people who proposed them suggested them for fixing old code and not as the way forward. Such code belong in separate libraries which (a) take effort to use so that the functions become unused and (b) so that the library can be removed when the last offender is gone.

类似地,来自大约同一时间的 LNW 文章:

There are no plans to add the C11 string bounds-checking interfaces from one of the annexes as there are questions about their usefulness even within the standards groups. That doesn't mean that those interfaces couldn't end up in the libc_ports tree, which provides a place for optional add-ons that aren't enabled by default. That would allow distributions or others to build those functions into their version of GLIBC.

关于c - 支持 strerrorlen_s 和 strerror_s 函数的最旧版本的 gcc/glibc 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17960423/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com