1.3.3. C/C++ Language Options¶
The tiarmclang compiler’s -std option allows you to specify which C or C++ language standard that compiler should adhere to when processing C or C++ source files.
The supported C and C++ language variants are described below in each section.
Note
Default C/C++ Language Standard
If no -std option is specified on the tiarmclang command line, then -std=gnu17 is assumed for C source files and -std=gnu++17 is assumed for C++ source files.
1.3.3.1. C Language Variants (-std)¶
For C <language-variants> of the form cNN, the compiler will pre-define the __STRICT_ANSI__ macro symbol to 1.
- -std=c89, -std=c90¶
C as defined in the ISO C 1990 standard
- -std=c99, -std=c9x¶
C as defined in the ISO C 1999 standard
- -std=c11, -std=c1x¶
C as defined in the ISO C 2011 standard
- -std=c17, -std=c18¶
C as defined in the ISO C 2017 standard, which addressed C11 defects without adding any new features
For C <language-variants> of the form gnuNN, GNU C language extensions are supported and the compiler will not define the __STRICT_ANSI__ macro symbol.
- -std=gnu89, -std=gnu90¶
C as defined in the ISO C 1990 standard with GNU extensions
- -std=gnu99, -std=gnu9x¶
C as defined in the ISO C 1999 standard with GNU extensions
- -std=gnu11, -std=gnu1x¶
C as defined in the ISO C 2011 standard with GNU extensions
- -std=gnu17, -std=gnu18¶
C as defined in the ISO C 2017 standard with GNU extensions. This is the default for C files if no -std option is defined.
1.3.3.2. C++ Language Variants (-std)¶
For C++ <language-variants> of the form c++NN, the compiler will pre-define the __STRICT_ANSI__ macro symbol to 1.
- -std=c++98, -std=c++03¶
C++ as defined in the ISO C++ 1998 standard with amendments
- -std=c++11¶
C++ as defined in the ISO C++ 2011 standard with amendments
- -std=c++14¶
C++ as defined in the ISO C++ 2014 standard with amendments
- -std=c++17¶
C++ as defined in the ISO C++ 2017 standard with amendments
For C++ <language-variants> of the form gnuNN, GNU C language extensions are supported and the compiler will not define the __STRICT_ANSI__ macro symbol.
- -std=gnu++98, -std=gnu++03¶
C++ as defined in the ISO C++ 1998 standard with amendments and GNU extensions
- -std=gnu++11¶
C++ as defined in the ISO C++ 2011 standard with amendments and GNU extensions
- -std=gnu++14¶
C++ as defined in the ISO C++ 2014 standard with amendments and GNU extensions
- -std=gnu++17¶
C++ as defined in the ISO C++ 2017 standard with amendments and GNU extensions. This is the default for C++ files if no -std option is defined.
See Characteristics and Implementation of Arm C++ for details about C++ 2017 support.
1.3.3.3. C/C++ Run-Time Standard Header and Library Options¶
- -nostdlib, --no-standard-libraries¶
Avoid linking in the C/C++ standard libraries. This is useful when partially linking an application, or when you want to link against your own AEABI-compliant libraries.
- -nostdinc, --no-standard-includes¶
Do not incorporate the C/C++ runtime header file directory, the compiler builtin include directory, or the standard system include directory in the default definition of the include file directory search path.
- -nostdlibinc¶
Do not incorporate the C/C++ runtime header file directory or the standard system include directory into the include file directory search path, but do incorporate the compiler’s builtin include directory.
1.3.3.4. C++ Exception Handling¶
- -fexceptions, -fno-exceptions¶
By default, the tiarmclang compiler provides no exception handling support. To enable exception handling, use the compiler’s -fexceptions option. See C++ Exception Handling for details.
- -frtti, -fno-rtti¶
By default, the tiarmclang compiler provides support for Run-Time Type Information (RTTI) features, such as the dynamic_cast operator, the typeid operator, and the type_info class.
To explicitly disable RTTI support, use the -fno-rtti option. If you disable RTTI support, use of the typeid operator causes an error. Use of dynamic_case causes an error only in certain situations.
To explicitly enable RTTI support, use the -frtti option.