7.27 --cpp_compat

Compiles C++ code to maximize binary compatibility.


Use --cpp11 --cpp_compat to compile C++11 source code using a subset of features that maximizes compatibility with source code compiled with C++03.
Use --cpp --cpp_compat to compile C++03 source code maximizing binary compatibility with C++03 code compiled using older compiler versions.
The --cpp11 --cpp_compat options behave in the same way as --cpp11 with the following restrictions:
  • When the --exceptions option is selected, the array new operator with a length not known at compile time does not perform bounds checking. This means that std::bad_alloc is thrown if there is an error rather than std::bad_array_new_length.
  • When the --exceptions option is selected, the delegating constructors language feature is disabled. Any use of delegating constructors when the --cpp_compat is selected results in an error message.
armcc passes the --cpp_compat option to armlink if it invokes armlink to perform a final link step.
You can combine the --cpp_compat option with other source language command-line options. For example:
  • armcc --cpp_compat --cpp11
  • armcc --cpp_compat --cpp
  • armcc --cpp_compat --cpp --gnu


When compiling with --cpp11 --exceptions, code can catch std::bad_array_new_length:
void variable_length_array_new(unsigned i) {
    bool exception_thrown = false;
    try {
        new int[i + 0x40000000];
    } catch (std::bad_array_new_length e)
When compiling with --cpp11 --cpp_compat --exceptions, code can only catch std::bad_alloc:
void variable_length_array_new_cpp_compat(unsigned i) {
    bool exception_thrown = false;
    try {
        new int[i + 0x40000000];
    } catch (std::bad_alloc e)


By default, the --cpp_compat option is not enabled.
For files with a suffix of .cpp, .cxx, .c++, .cc, or .CC, the --cpp option applies by default.
Related reference
7.19 --c90
7.20 --c99
7.74 --gnu
7.25 --cpp
7.156 --strict, --no_strict
7.26 --cpp11
1.2 Source language modes of the compiler
2.7 Filename suffixes recognized by the compiler
10.13 C++11 supported features
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.