Language-related strategies limit or avoid the use of ISO C++ features. While these features can make software design and maintenance easier, they can also increase code size.
For optimal code size, do not use virtual functions unless absolutely necessary. A virtual function is never dead-stripped, even if it is never called.
If code size is an issue, do not use RTTI because it generates a data table for every class. Disabling RTTI decreases the size of the data section.
The EC++ proposal does not allow runtime type identification.
See also “Controlling RTTI”.
If you must handle exceptions, be careful when using C++ exception handling routines. Carbide has a zero runtime overhead error handling mechanism. However, using exceptions does increase code size, particularly the exception tables data.
The EC++ proposal does not allow exception handling.
NOTE The proposed ISO standard libraries and the use of the new operator require exception handling.
The C++ new operator might throw an exception, depending on how the runtime library implements the new operator. To make the new operator throw exceptions, set __throws_bad_alloc to 1 in the prefix file for your target and rebuild your library. To prevent the new operator from throwing exceptions, set __throws_bad_alloc to 0 in the prefix file for your target and rebuild your library.
See your release notes or Targeting manual for more information.
Implementing multiple inheritance requires a modest amount of code and data overhead. The EC++ proposal does not allow multiple inheritance.
For optimal code size, do not use virtual inheritance. Virtual base classes are often complex and add a lot of code to the constructor and destructor functions.
The EC++ proposal does not allow virtual inheritance.