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/58130531/

相关文章:

c - 删除链表时输出错误

c - 图像处理..背景减法

c - C中void指针的指针运算

c - 空指针作为参数

c++ - 解决 C++ 'target of assignment not really an lvalue' 错误

javascript - 理解 JavaScript 的值传递

c - 使 GtkStatusbar 的文本可选择

c++ - Visual Studio 2003 编译器行为

c - 有人为 MSP430 的 IAR Embedded Workbench 实现了 __getzone() 吗?

c - C99 fesetround()/fegetround() 状态是按线程还是按进程?