Safe and Efficient C++ for Embedded Environments 2025

Safe and Efficient C++ for Embedded Environments is a two-day onsite training course with programming examples, taught by Andreas Fertig.  It is offered at the Gaylord Rockies from 09:00 to 17:00 Aurora time (MDT) on Saturday and Sunday, September 13th and 14th, 2024 (immediately prior to the conference). Lunch is included.

Register HereSee Other Offerings

Course Description

As a developer working with embedded systems, you need tools that help you build smarter, more efficient software. And that’s exactly what the latest C++ updates deliver. With these advancements, tackling the challenges of embedded environments—like those that follow MISRA, Autosar, or SIL—becomes easier. You can meet the strictest standards without sacrificing performance or reliability.

This course will enhance your embedded systems skills using modern C++. Through practical examples, you will learn how to write code that is safer, more robust, and more efficient. You will see patterns to replace the POSIX length value API.

We’ll start with the basics and gradually move on to more advanced topics, all designed to make your code stronger and more efficient.

Coroutines add a whole new level to writing parsers. You’ll learn how they work and how to use them without relying on the heap.

Many embedded systems operate without a heap. We explore standard compliant and undefined behavior-free ways to deal with custom allocators. You’ll see firsthand how unique_ptr, from the Standard Library (STL), can be a game changer even in memory-constrained environments.

This directly leads to the next topic, using the STL in an embedded environment, which often disallows using the global heap or exceptions. You’ll learn to effectively leverage STL features in these contexts. Do you need to use std::chrono but face compatibility issues with your hardware clock? I’ll show you how to seamlessly integrate your custom clock with STL’s std::chrono, ensuring that everything works harmoniously.

Lastly, error handling can be tricky in embedded programming, especially without exceptions. You’ll gain insights into the powerful capabilities of C++23’s std::expected, making your code more readable, maintainable, and resilient.

By the end of this course, you’ll not only be well-versed in the latest C++ features tailored for embedded systems but you’ll also be equipped to write type-safe code that effectively avoids common pitfalls such as out-of-bounds access. Improve your code’s readability and maintain efficiency, all while mastering the art of embedded programming with confidence.

The course is a hands-on course. Theory is interspersed with demos and exercises.

Prerequisites

Students are expected to have a basic knowledge of C++11.

Course Topics

  • Language features in C++
    • Explicit data type conversion
    • Uniform initialization
    • Digit separator
    • auto type deduction
    • range-based for loops
    • Strongly typed enum
    • static or inline
    • Attributes
    • User defined literals applied
  • Avoid code bloat in C++
  • Controlling your objects (OOP)
    • class or struct
    • explicit
    • Default member initialization
    • Constructor delegation
    • Deliberately disable member functions
    • Virtual functions
    • Curiously Recurring Template Pattern
  • ROM-ability
  • Coroutines: Resumable functions
  • Living without the heap
    • Dynamic memory management
    • Properly aligning your local heap buffer
    • Placement-new
    • The STL as an alternative to placement-new
    • Implementing a pool allocator
    • std::unique_ptr
  • Standard Template Library meets embedded
    • STL rules of thumb
    • Safe headers for embedded environments
    • std::chrono
    • std::array
    • std::span
    • std::optional
    • std::string_view
    • std::expected
    • Peaking into algorithms

Course Instructor

Andreas Fertig

Andreas Fertig is an expert C++ trainer and consultant who delivers engaging and impactful training sessions, both on-site and remotely, to teams around the globe.

As an active member of the C++ standardization committee, Andreas contributes directly to shaping the future of the language. He shares insights on writing cleaner, more efficient C++ code at international conferences. He publishes specialist articles, e.g., for iX magazine, and has published several C++ textbooks.

With C++ Insights (https://cppinsights.io), Andreas has created an internationally recognized tool that enables users to look behind the scenes of C++ and thus understand constructs even better.

Discover more about Andreas and his work at andreasfertig.com.

Register HereSee Other Offerings