_GNU_SOURCE和__USE_GNU [英] _GNU_SOURCE and __USE_GNU

查看:168
本文介绍了_GNU_SOURCE和__USE_GNU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 CPU_SET ,这是一个应该在 sched.h中该手册页明确指出, _GNU_SOURCE 必须定义,这样的宏定义。然而,看着头, CPU_SET 定义只有当 __ USE_GNU 定义(有一个 #IFDEF 后卫)。我似乎在几年前的 _GNU_SOURCE 需要记住。

I want to use CPU_SET, which is a glibc linux-specific macro that should be defined in sched.h The manpage clearly states that _GNU_SOURCE must be defined so that the macro is defined. However, looking at the header, CPU_SET is defined only if __USE_GNU is defined (there is an #ifdef guard). I seem to remember a few years ago that _GNU_SOURCE was needed.

问题:

1)明确的联机帮助页关闭。我如何通知维护人员的手册页是不正确的?

1) Clearly the manpage is off. How do I notify the maintainer that the manpage is incorrect?

2)什么时候从 _GNU_SOURCE __ USE_GNU过渡到 发生(无论是在版本或时间)方面

2) When did the transition from _GNU_SOURCE to __USE_GNU happen (either in terms of version or time)

3)是否有情况,其中的glibc的较新版本仍然使用 _GNU_SOURCE ?或者,我可以有把握地认为限定了 __ USE_GNU 就足够了?

3) Are there circumstances where newer versions of glibc still use _GNU_SOURCE? Or can I safely assume that defining __USE_GNU is sufficient?

推荐答案

_GNU_SOURCE 是你曾经自己定义唯一的一个。 __ USE_GNU 通过一种机制,内部定义的 features.h (这是由所有其他的glibc头在内)时, _GNU_SOURCE 的定义,并有可能在其他条件。定义或取消定义 __ USE_GNU 自己将严重打破glibc的头。

_GNU_SOURCE is the only one you should ever define yourself. __USE_GNU is defined internally through a mechanism in features.h (which is included by all other glibc headers) when _GNU_SOURCE is defined, and possibly under other conditions. Defining or undefining __USE_GNU yourself will badly break the glibc headers.

这篇关于_GNU_SOURCE和__USE_GNU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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