Logo

Blog


C++

The correct way to do type punning in C++ - The second act

Last time, I wrote about type-punning in C++ and how C++20's std::bit_cast can help you. Today, I want to discuss a different reason for type-punning where std::bit_cast might not [...]
C++

The correct way to do type punning in C++

Today's post is relevant for everybody who does type punning in C++. Something I did for years while working in the embedded software domain. Something others have done for a long [...]
C++

2025 updates

I made a couple of changes in 2025. Here is a brief outline. [...]
C++

C++ for embedded systems: constexpr and consteval

In today's post, I'll learn how modern C++ can influence the code you write for your embedded system. You will see code using up to C++23. The example I show you below circles [...]
C++

How to use a constexpr std::string

With C++20 we got consexpr std::vector and std::string in the STL. An awesome feature, I think, from a technical standpoint. However, the initial joy often ends quickly once most [...]
C++

Write more C++ code thanks to constexpr

Since the keyword constexpr and its behavior got included in C++, it has been improved in each and every new standard of the language. [...]
C++

Why is C++23 called 23?

First, if you haven't heard the good news, C++23 was finally published by ISO. Looking at how I (and others) name this C++ standard raises the question: Why call it 23 when ISO [...]
C++

unique_ptr and the pointer to implementation idiom

Last time, I wrote about unique_ptr and PImpl, demonstrating why you can't use a unique_ptr for PImpl. This time, I'd like to show you how you can make unique_ptr work with PImpl. [...]
C++

Smart pointers and the pointer to implementation idiom

A post I wrote back in 2023 When an empty destructor is required resulted in feedback that I'd like to address in today's post. [...]
C++

Understanding the inner workings of C++ smart pointers - The shared_ptr

After last months Understanding the inner workings of C++ smart pointers - The unique_ptr with custom deleter you're curious about how the shared_ptr is implemented? Great! Here [...]