General C++ options can be used to control the following C++ features:
whether the keywords
wchar_tandboolare recognizedthe scope of initialization directives in
forandwhileloopswhether the old specialization syntax is accepted
None of the language features listed above is supported in Cfront C++ mode.
-K arg1[,arg2...]
General input rules for the -K option can be found on "Calling syntax and general rules". The following entries are possible as arg arguments to control the C++ frontend:
using_std
no_using_std
These arguments determine the use of the C++ library functions for which names have been defined in the standard name space std.
If -K using_std is specified, the compiler behaves as if the following lines were entered at the start of a compilation unit:
namespace std{}
using namespace std;
-K using_std is the default in extended C++ V3 mode (-X v3-compatible -X nostrict).
-K no_using_std is the default in strict C++ V3 mode (-X v3-compatible -X strict), in C++ 2017 mode (-X 2017) and in C++ 2020 mode (-X 2020) and the only possible behavior in Cfront C++ mode (-X v2-compatible).
If -K no_using_std is set in the mode C++ V3, C++ 2017 or C++ 2020, the source program must contain the directive using namespace std; before the first call to a C++ library function or the names must be qualified appropriately.
wchar_t_keywordno_wchar_t_keyword
These arguments can be used to define whether wchar_t is recognized as a keyword.
-K wchar_t_keyword is the default in mode C++ V3 and the only possible behavior in mode C++ 2017 and C++ 2020. In this case, the preprocessor macro _WCHAR_T is defined.
-K no_wchar_t_keyword is the default and the only possible behavior in the Cfront C++ mode.
boolno_bool
These arguments can be used to define whether bool is recognized as a keyword.
-K bool is the default in mode C++ V3 and the only possible behavior in mode C++ 2017 and C++ 2020. In this case, the preprocessor macro _BOOL is defined.
-K no_bool is the default and the only possible behavior in the Cfront C++ mode.
old_for_initnew_for_init
These arguments define how an initialization directive in for and while loops is to be handled.
-K old_for_init
Specifies that an initialization directive has the same scope as the entire loop. This is the default setting in the Cfront C++ mode.
-K new_for_init
Specifies the new ANSI C++-compliant scope rule, which surrounds the entire loop in its own implicitly generated scope.This is the default setting in mode C++ V3 and the only possible behavior in mode C++ 2017 and C++ 2020.
no_old_specializationold_specialization
These arguments are only relevant in the modes C++ V3, C++ 2017 and C++ 2020. They are used to specify whether template specializations need the new syntax template<>.
-K no_old_specialization is the default setting in mode C++ V3 and the only possible behavior in mode C++ 2017 and C++ 2020. In this case, the compiler implicitly defines the macro__OLD_SPECIALIZATION_SYNTAX with the value 0.
If -K old_specialization is specified, the the compiler implicitly defines the macro__OLD_SPECIALIZATION_SYNTAX with the value 1.