如何找到我当前编译器的标准,比如它是 C90 等 [英] How to find my current compiler's standard, like if it is C90, etc
问题描述
我正在使用 Linux 机器.是否有任何系统命令可以找到我正在使用的 C 编译器所遵循的标准?
I'm working on a Linux machine. Is there any system command to find the standard followed by the C compiler I'm using?
推荐答案
这取决于编译器,我假设你使用的是 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 标准的版本号,长整数yyyymmL 形式的常数,其中yyyy 和 mm 是年和月标准版.这意味着哪个版本的 C 标准编译器符合.像 STDC,这不一定准确整个实现,除非 GNUCPP 正在与 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 表示 1989 C1994 年修订的标准,即当前默认值;值 199901L表示 C 的 1999 年修订版标准.支持 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 选项,编译 C++ 或 Objective-C 时也不使用.
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屋!