C++1x for embedded systems (compact)


Description

The flexibility of the language C++ has improved even further with the new features of the standard C++11 and its successors. Some of these innovations are particularly interesting for embedded systems. To move computations from run to compile time is now possible. This results in a smaller code and an increased speed. Are you also tired of writing ++i and still trying to get > and >= right on occasion? C++1x supports you by leaving recurrent writings of this type to the compiler. As a result, you gain more time to write really sophisticated code.

In this class you will learn how C++1x supports you to write faster and more robust code.

Content

In this class, attendees familiarize themselves with C++1x applied to embedded systems. Although C++1x is not specifically designed for embedded systems, the language contains various valuable features for such systems. Participants receive the knowledge to optimize conscious code size or performance.

An example is static_assert. With this function, it is possible to check conditions already at compile time. Calculations can also be done with constexpr functions already at compile time. In both cases, the application of the feature has a positive effect on the run-time behavior and the code size.

The use of move-semantics promises faster and more efficient copying operations. Participants will learn how move-semantics work, how to use it, and in what situations the compiler will disable them.

In the course of the class, the participants will learn which new features of C++1x they can use in their code base. Complex problems can be formulated more easily by means of the extended support of the compiler. The resulting code is often more robust and less error-prone. All participants who work with an older compiler without C++1x will receive tips and suggestions on how to use new features in their code.

After the class, participants write clearer and more precise code. For example, participants will pass code reviews easier and safer.

Topics Outline

  • Clean and modern C++ code
  • Do things at compile-time: constexpr, constexpr if
  • The right choice at the right time: preprocessor, inline or constexpr
  • Interesting C++1x elements for embedded systems: override, auto, literal-operator, nullptr
  • Influence of C++1x to performance and code size
  • GSL als Unterst├╝tzung: narrow_cast, not_null, finally
  • Templates: the proper dose
  • Usage of the new initializer-lists