Leveraging C++20/23 Features for Low Level Interactions
Talkat CppCon 2024 · on Tuesday, 2024-09-17· at 14:00· Cottonwood 2/3, 6700 North Gaylord Rockies Boulevard·
summary
Shows concrete techniques: uses inout_ptr/out_ptr to avoid stale raw pointers crossing into C, initializes smart pointers to MMIO with a type-specific custom deleter so hardware never gets deleted, defines register layouts as packed volatile aligned structs and casts base addresses with reinterpret_cast, and moves bit math into the compiler with constexpr utilities and std::bit_cast/byte-swap helpers for endian and swizzle work. Examples include testable dependency-injected register mocks and compile-time checks.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:30Why C dominates hardware
- 5:28C++ for hardware & bit manipulation
- 8:37Smart pointers with C APIs
- 14:00Breaking kernel-centric C
- 15:23Naive vs modern hardware access
- 23:36Register access with structs
- 28:32Smart pointers for hardware
- 30:01Managing register interactions
- 34:18Strong typing for bit manipulation
- 39:12C++26 hardware features
- 41:22Safety in hardware C++
- 57:11Q&A
related talks
01h 02mEmbedded Friendly C++: Features That Make a Difference
07mC++ Hardware Register Access
01h 03mUnlocking the value of C++20
55mC++ in the World of Embedded Systems
01h 01mEmbracing PODs Safely Until They Die
50mTwo advanced PMR techniques in C++17/20
58mUnderstanding and Mastering C++'s Complexity
59mC++ Memory Model: from C++11 to C++23
