The compiler
supports the C++ language, if the C++ feature is enabled with a license file.
Some features of the C++ language are not designed for embedded controllers. If they are used, they may produce large amounts of code and require a lot of processor overhead, thereby sapping performance.
Avoid this situation by using the compactC++ and EC++ language extensions, which are subsets of the C++ language. Each subset is adapted for embedded application programming.
These subsets of the C++ language avoids implicit and explicit overhead of the C++ language (for example, virtual member functions and multiple inheritance). The EC++ is a restricted subset, while compactC++ includes features which are not in the EC++ definition. This makes it more flexible.
Another key aspect of compactC++ is its flexible configuration of the language (for example, allowed keywords, code generation behavior, and message management). The compiler is adapted for the special needs for embedded programming.
The compiler provides the following language settings:
- ANSI-C: The compiler behaves as an ANSI-C compiler. It is possible to force the compiler into a strict ANSI-C compliant mode, or to use language extensions designed for efficient embedded systems programming.
- EC++: The compiler behaves as a C++ compiler. The following features are not allowed in EC++:
- Mutable specifier
- Exception handling
- Runtime type identification
- Namespace
- Template
- Multiple inheritance
- Virtual inheritance
- Library support for w_char and long double
- cC++, compactC++: In this mode, the compiler behaves as a full C++ compiler that allows the C++ language to be configured to provide compact code. This enables developers to enable/disable and configure the following C++ features:
- Multiple inheritance
- Virtual inheritance
- Templates
- Trigraph and bigraph
- Compact means:
- No mutable qualifier
- No exception handling
- No runtime type identification
- No namespaces
- No library support for w_char and long double
- C++: The compiler behaves as a full C++ compiler. However, because the C++ language provides some features not usable for embedded systems programming, such features may be not usable.
Note: Currently, for the MCU V10.x release, the Eclipse UI only allows you to turn C++ language support on or off. The UI currently does not implement settings for EC++ and compactC++ language extensions. You must use command line arguments to specify the compiler's support for these language extensions. More details on these arguments can be found in
Compiler Options chapter, under -C++ (-C++f, -C++e, -C++c): C++ Support.