gcc编译选项std=c++1y和std=c++14。

时间:2020-12-30 02:12:09

I installed gcc 4.9.2. I compiled the program using the following command:

我安装gcc 4.9.2。我使用以下命令编译程序:

/root/gcc-4.9.2/bin/g++ -std=c++1y testing.cpp

/root/gcc-4.9.2/bin/g + + y testing.cpp化= c + + 1

Note that in addition to the option "-std=c++1y", there is another option "-std=c++14". Will the compiler work in the same way and generate exactly the same executable for both options? Thanks!

注意,除了选项“-std=c++1y”之外,还有另一个选项“-std=c++14”。编译器会以同样的方式工作,并为两个选项生成完全相同的可执行文件吗?谢谢!

1 个解决方案

#1


21  

C++ 14 is the latest ISO standard, and should be used unless you need some gcc non standard feature

c++ 14是最新的ISO标准,应该使用,除非您需要一些gcc非标准特性。

c++1y is a name that was used to refer to the c++14 standard before it was completed, so it is most likely adhering to a draft of the standard, but not the actual standard itself. There may be some minute differences between the two, but c++14 is the ISO standard

c++1y是在它完成之前被用来引用c++14标准的名称,所以它很可能是遵循标准的草案,而不是实际的标准本身。两者之间可能有细微的差别,但是c++14是ISO标准。

In short, use c++14

简而言之,使用c++ 14

#1


21  

C++ 14 is the latest ISO standard, and should be used unless you need some gcc non standard feature

c++ 14是最新的ISO标准,应该使用,除非您需要一些gcc非标准特性。

c++1y is a name that was used to refer to the c++14 standard before it was completed, so it is most likely adhering to a draft of the standard, but not the actual standard itself. There may be some minute differences between the two, but c++14 is the ISO standard

c++1y是在它完成之前被用来引用c++14标准的名称,所以它很可能是遵循标准的草案,而不是实际的标准本身。两者之间可能有细微的差别,但是c++14是ISO标准。

In short, use c++14

简而言之,使用c++ 14