I installed gcc 4.9.2. I compiled the program using the following command:
/root/gcc-4.9.2/bin/g++ -std=c++1y testing.cpp
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?
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. In short, use c++14 .
Default gcc command is the GNU dialect of ISO C90 (including some C99 features). This is the default for C code.
GCC supports the original ISO C++ standard published in 1998, and the 2011, 2014, 2017 and mostly 2020 revisions. The original ISO C++ standard was published as the ISO standard (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 2003 (ISO/IEC 14882:2003).
0 released, full of improved C++11 and C++14 features. GCC 4.9. 0 is now available, with further improved C++11 and C++14 conformance.
C++ 14
is the latest ISO standard, and should be used unless you need some gcc non standard feature.
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.
In short, use c++14
.
In case of gcc 4.9.2 mentioned by you there is no difference between c++14
and c++1y
. But for the earlier gcc version, e.g. gcc 4.8.1 there is no c++14
option
g++: error: unrecognized command line option '-std=c++14'
because the year of standard acceptance was not known yet. In such cases using the -std=c++1y
option is only solution to enable some parts of oncoming c++14 standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With