1.3.3. C/C++ Language Options

The c29clang compiler’s -std option allows you to specify which C or C++ language standard the compiler should adhere to when processing C or C++ source files.

The supported C and C++ language variants are described below.

Note

Default C/C++ Language Standard

If no -std option is specified on the c29clang 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 pre-defines 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 does 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 pre-defines 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

Note

C++ support is based on a library that is focused on support for C++17. If you specify an earlier version of the C++ standard, it is not guaranteed that features that were not required by that standard will be unsupported.

For C++ <language-variants> of the form gnuNN, GNU C language extensions are supported and the compiler does 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 C29x 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 standards-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. Run-Time Type Information (RTTI) Options

-frtti, -fno-rtti

The c29clang compiler allows you to support Run-Time Type Information (RTTI) features, such as the dynamic_cast operator, the typeid operator, and the type_info class.

By default RTTI support is disabled, which is equivalent to using the -fno-rtti option. When RTTI support is disabled, 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.