我在linux上使用的是gcc 4.4.2
我想知道的是,gcc是否自动默认使用c99作为其最新标准进行编译?
如何指定是使用c89编译还是使用c99编译?
非常感谢你的建议,
发布于 2010-01-23 15:53:08
默认情况下不使用C99的一个原因是该标准在编译器中还没有完全实现。但是,我相信你可以在编译gcc时设置默认模式,所以如果标准的选择对你来说真的很重要,最好总是通过这个选项。
选项分别为-std=c99和-std=c89。
发布于 2010-01-23 15:53:54
从gcc(1)手册页:
-std=
Determine the language standard. This option is currently only
supported when compiling C or C++.
....
c99
c9x
iso9899:1999
iso9899:199x
ISO C99. Note that this standard is not yet fully supported;
see <http://gcc.gnu.org/gcc-4.4/c99status.html> for more
information. The names c9x and iso9899:199x are deprecated.
gnu89
GNU dialect of ISO C90 (including some C99 features). This is
the default for C code.
gnu99
gnu9x
GNU dialect of ISO C99. When ISO C99 is fully implemented in
GCC, this will become the default. The name gnu9x is
deprecated.https://stackoverflow.com/questions/2122527
复制相似问题