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