Introduction
- This course demonstrates the applicability and advantages of C++ to the embedded developer.
- Examples of high consequence real world embedded software failures.
- Techniques to reduce source code size and eliminate common manual programming tasks.
- Issues of memory and resource management which can lead to intermittent, and hard to find and fix classes of bugs.
- Performance implications of advanced C++ constructs.
- Decoupling/maintainability.
- Details of test driven development/defensive programming techniques.
- Details of interface-hidden performance enhancement techniques.
Overview of C++ for Embedded
- C++ for embedded systems. Advantages and use cases.
- Generality and Flexibility.
- Superset of C - Backward Compatibility.
- Pay Only for What you Use.
Advanced C++ Features and Overheads
- Zero Overhead Features.
- Constructor Overhead. Destructor Overhead.
- Inheritance / Virtual Function Overhead.
- Multiple Inheritance Overhead.
- Virtual Inheritance Overhead.
Exercise
Inheritance / Virtual Functions. Template Overhead. RTTI Overhead. Exception Overhead.
Resource Management
- Introduction to resource management in C++.
- Resource Acquisition Is Initialization.
- Canonical Class.
- boost::scoped_ptr.
- boost::shared_ptr.
- Canonical Smart Pointer.
- STL Containers.
- boost::optional.
Exercise
Resource Management. Resource Objects. Overloading Operator "new" and Operator "delete". Placement "new".
Performance Enhancement
- The use of Inline Functions.
- Pass by Const Reference.
- Temporary Variables.
- Pre and Post Increment.
Exercise
Performance Enhancement. Reference Counted Class Data. Mutable, Caching and Lazy Evaluation. Template Caches.
Specialized Topics
- Const Correctness.
- Macro Alternatives.
- Decoupling.
- Unit Classes.
- Case Studies: Mars Climate Orbiter Templatized Precision. Crash of F22 Avionic Computer.
Exercise
Templatized Precision Unit Classes. Separation of Model and View.
Testing
- The use of tests. Good practices and techniques.
- Test Driven Development.
- Programming by Contract.