C++ For Embedded Developers (2023-04-18 - 2023-04-20)

Goal

Give an idea how an experienced C programmer can benefit from the C++ toolcase. The following aspects are covered, accompanied with many exercises.

  • C++ is an object oriented language. That term alone has many facets, and a solid understanding of each is given. Constructors, destructors, automatic pointer/base-class conversion, late binding (“abstract”?), and all that.

  • C++ also brings a rich toolset in form of its standard library. After a short conceptual introduction, containers and algorithms are something that is immediately useful for non-OO programmers.

  • C++ does not stop there; starting from its 2011 definition, the language has undergone a major revolution. An overview is given.

Work Environment

Preferred: Ubuntu under Windows (WSL)

I suggest you use the Windows Subsystem For Linux (WSL2) (Microsoft documentation here). This sets up a virtualized Ubuntu inside Windows, together with all interoperability wazoo.

When installed, open a Ubuntu terminal, and install the software that is required for this training.

$ sudo apt update
$ sudo apt install git build-essential cmake libgtest-dev libgmock-dev

Skeleton Project Setup

Follow the instructions in the course project README to setup the initial version of the course project.

Day 1

Introduction

Some Details

Standard Template Library

From Standard Template Library

OO

From Data Encapsulation

Day 2

Warm-Up

Sensor Exercise, Resolved

OO, Cont’d

From Functions and Methods

Smart Pointers

Day 3

Smart Pointers (Continued)

Heavy Weight OO 💪

Complete the pointless point class, by quickly moving across the following topics from Data Encapsulation

From Inheritance And Object Oriented Design

See live-hacked code in interfaces.cpp.

Exception Handling

From Exceptions:

Exercises: Containers And Algorithms

From C++ Exercises: Standard Template Library:

Exercises: OO And Interfaces