C++ standard
[root@host1 ~]# g++ --version
g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@host1 ~]# g++ -v --help 2>/dev/null | grep -E "^\s+\-std=.*$"
-std=<standard> Assume that the input sources are for <standard>.
-std=f2003 Conform to the ISO Fortran 2003 standard.
-std=f2008 Conform to the ISO Fortran 2008 standard.
-std=f2008ts Conform to the ISO Fortran 2008 standard
-std=f2018 Conform to the ISO Fortran 2018 standard.
-std=f95 Conform to the ISO Fortran 95 standard.
-std=gnu Conform to nothing in particular.
-std=legacy Accept extensions to support legacy code.
-std=c++03 Conform to the ISO 1998 C++ standard revised by
-std=c++98.
-std=c++0x Deprecated in favor of -std=c++11. Same as
-std=c++11.
-std=c++11 Conform to the ISO 2011 C++ standard.
-std=c++14 Conform to the ISO 2014 C++ standard.
-std=c++17 Conform to the ISO 2017 C++ standard.
-std=c++1y Deprecated in favor of -std=c++14. Same as
-std=c++14.
-std=c++1z Deprecated in favor of -std=c++17. Same as
-std=c++17.
-std=c++2a Conform to the ISO 2020(?) C++ draft standard
-std=c++98 Conform to the ISO 1998 C++ standard revised by
-std=c11 Conform to the ISO 2011 C standard.
-std=c17 Conform to the ISO 2017 C standard (expected to
-std=c18 Conform to the ISO 2017 C standard (expected to
-std=c1x Deprecated in favor of -std=c11. Same as
-std=c11.
-std=c89 Conform to the ISO 1990 C standard. Same as
-std=c90.
-std=c90 Conform to the ISO 1990 C standard.
-std=c99 Conform to the ISO 1999 C standard.
-std=c9x Deprecated in favor of -std=c99. Same as
-std=c99.
-std=gnu++03 Conform to the ISO 1998 C++ standard revised by
-std=gnu++0x Deprecated in favor of -std=gnu++11. Same as
-std=gnu++11.
-std=gnu++11 Conform to the ISO 2011 C++ standard with GNU
-std=gnu++14 Conform to the ISO 2014 C++ standard with GNU
-std=gnu++17 Conform to the ISO 2017 C++ standard with GNU
-std=gnu++1y Deprecated in favor of -std=gnu++14. Same as
-std=gnu++14.
-std=gnu++1z Deprecated in favor of -std=gnu++17. Same as
-std=gnu++17.
-std=gnu++2a Conform to the ISO 2020(?) C++ draft standard
-std=gnu++98 Conform to the ISO 1998 C++ standard revised by
-std=gnu11 Conform to the ISO 2011 C standard with GNU
-std=gnu17 Conform to the ISO 2017 C standard (expected to
-std=gnu18 Conform to the ISO 2017 C standard (expected to
-std=gnu1x Deprecated in favor of -std=gnu11. Same as
-std=gnu11.
-std=gnu89 Conform to the ISO 1990 C standard with GNU
-std=gnu90 Conform to the ISO 1990 C standard with GNU
-std=gnu99 Conform to the ISO 1999 C standard with GNU
-std=gnu9x Deprecated in favor of -std=gnu99. Same as
-std=gnu99.
-std=iso9899:1990 Conform to the ISO 1990 C standard. Same as
-std=c90.
-std=iso9899:199409 Conform to the ISO 1990 C standard as amended in
-std=iso9899:1999 Conform to the ISO 1999 C standard. Same as
-std=c99.
-std=iso9899:199x Deprecated in favor of -std=iso9899:1999. Same
-std=iso9899:2011 Conform to the ISO 2011 C standard. Same as
-std=c11.
-std=iso9899:2017 Conform to the ISO 2017 C standard (expected to
-std=iso9899:2018 Conform to the ISO 2017 C standard (expected to
[root@host1 ~]#
[root@host1 ~]# echo | g++ -dM -E -x c++ - | grep -F __cplusplus
#define __cplusplus 201402L
[root@host1 ~]# echo | g++ -std=c++03 -dM -E -x c++ - | grep -F __cplusplus
#define __cplusplus 199711L
[root@host1 ~]# echo | g++ -std=c++11 -dM -E -x c++ - | grep -F __cplusplus
#define __cplusplus 201103L
コメント
コメントを投稿