如何找到我当前的编译器标准,例如C90等 [英] How to find my current compiler's standard, like if it is C90, etc

查看:91
本文介绍了如何找到我当前的编译器标准,例如C90等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Linux机器上工作。

I'm working on a Linux machine. Is there any system command to find the standard followed by the C compiler I'm using?

推荐答案

这是依赖于编译器的,我是否有任何系统命令来查找所使用的C编译器所遵循的标准?假设您正在使用GCC。
您可以使用以下命令检查编译器定义的宏:

This is compiler dependent, I'm supposing you're using GCC. You could check your compiler defined macros using:

gcc -dM -E - < /dev/null

检查有关标志的手册,特别是:


此宏扩展为C Standard的
版本号,一个长整数
常数,格式为yyyymmL,其中
yyyy和mm是
标准版的年和月。这表示

编译器符合哪个C标准版本。像 STDC 一样,
对于整个实现中的
不一定是准确的,除非GNU
CPP与GCC一起使用。

This macro expands to the C Standard's version number, a long integer constant of the form yyyymmL where yyyy and mm are the year and month of the Standard version. This signifies which version of the C Standard the compiler conforms to. Like STDC, this is not necessarily accurate for the entire implementation, unless GNU CPP is being used with GCC.

值199409L表示在1994年修改的1989 C
标准,即当前默认值
;值199901L
表示1999年修订C
标准。对1999年
修订版的支持尚未完成。

The value 199409L signifies the 1989 C standard as amended in 1994, which is the current default; the value 199901L signifies the 1999 revision of the C standard. Support for the 1999 revision is not yet complete.

如果使用
-traditional-cpp选项,或者当

This macro is not defined if the -traditional-cpp option is used, nor when compiling C++ or Objective-C.

此网站,您可以找到很多有关此的信息。请参见此处

In this site you can find a lot of information about this. See the table present here.

这篇关于如何找到我当前的编译器标准,例如C90等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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