gpt4 book ai didi

c - 哪个标准定义了 "sysconf()"选项的值,例如 "_SC_MONOTONIC_CLOCK"?

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

(这是 how to check if monotonic clock is supported 的后续问题)

我尝试打印 _SC_MONOTONIC_CLOCK 的值并得到 149。我试过谷歌 searchPOSIX网站并没有得到任何结果。

(回答后更新:149 在 Debian 上。刚刚在 macOS 和 FreeBSD 上试过,两者都使用值 74。)

最佳答案

POSIX states符号常量 _SC_*unistd.h header 中定义:

The unistd.h header shall define the following symbolic constants for sysconf(): [...] _SC_MONOTONIC_CLOCK

但是,它没有定义这种符号常量的值是什么——它对您的应用程序不重要(并且您不应该依赖于该值是什么)。

例如,GNU C 库列出了所有这些 in an enum ;而 newlib 定义了 explicit values . OpenBSDNetBSD也使用明确但不同的值。

关于c - 哪个标准定义了 "sysconf()"选项的值,例如 "_SC_MONOTONIC_CLOCK"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50265406/

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