features.h标头的目的是什么? [英] What is the purpose of features.h header?

查看:394
本文介绍了features.h标头的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

features.h标头的目的是什么?为什么以及何时可以在我的代码中使用它?

What is the purpose of the features.h header? Why and when can it be used in my code?

它是否定义了系统支持的源功能? 还是它定义了一些其他必须根据其他定义进行定义的东西?

Does it define source features supported by the system? Or does it define some additional things which must be defined depending on other defines?

推荐答案

features.h头文件提供了各种宏定义,这些宏定义指示与其他头文件的标准符合性,即应打开或关闭哪些功能(因此而命名).取决于用户希望使用的标准.

The features.h header file provides various macro definitions that indicate standard conformance to other header files, i.e. which features (hence the name) should be turned on or off depending on which standard the user wishes to use.

大多数C/C ++编译器都有命令行选项来处理标准一致性.让我们以GCC为例:传递-std=gnu9x选项时,您要求提供C99标准的GNU方言. features.h标头可确保包含它的所有其他标头将完全打开或关闭支持该特定方言所需的那些功能.这可以通过#define -ing或#undef-某些中间"宏实现.

Most C/C++ compilers have command line options to handle standards conformance. Let's take GCC as an example: when you pass the -std=gnu9x option, you ask for the GNU dialect of the C99 standard. The features.h header makes sure that all other headers that include it will turn exactly those features on or off that are needed to support this particular dialect. This is achieved by #define -ing or #undef - ing some "intermediate" macros.

此外,features.h还提供了glibc版本信息宏,以及其他各种位&鲍勃.

As a bonus, features.h also provides the glibc version information macros as well, and various other bits & bobs.

这篇关于features.h标头的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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