c - 如何找到我当前的编译器标准,比如它是 C90 等

标签 c compiler-construction c99 c89

我在 Linux 机器上工作。是否有任何系统命令可以找到我正在使用的 C 编译器所遵循的标准?

最佳答案

这取决于编译器,我假设您使用的是 GCC。 您可以使用以下方法检查编译器定义的宏:

gcc -dM -E - < /dev/null

检查 manual about the flags ,特别是:

__STDC_VERSION__

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.

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.

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

this site你可以找到很多关于这个的信息。见本表here .

关于c - 如何找到我当前的编译器标准,比如它是 C90 等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4991707/

相关文章:

c - 这是最佳的转变方式吗?

c - 在 c99 中使用 open_memstream

c - Flex 启动条件意外结果

c - Point Grey firefly MV、dc1394 和 USB 3.0

C 子进程创建

javascript - 查找字符串行是否嵌套或者是另一行的子行

c - f(n) = n + f(floor(n/2)) 是否有封闭形式?

c++ - 人们说 C++ 有 "undecidable grammar"是什么意思?

parsing - 左分解和删除左递归 JavaCC

c - 在 ARM 平台上,如何访问在内存中正确对齐的字符串的各个字符?