Type punning in modern C++

EN

Type punning is often used in C++ for fast floating-point math, deserialising C++ objects from a sequence of bytes, and other purposes. Popular techniques involve unions, reinterpret_cast, and memcpy. C++20 will provide new and better tools, such as std::bit_cast, std::bless, and new implicit object creation rules.

This talk is a comprehensive overview of all of these techniques. We will discuss when and how they can be used safely without causing undefined behaviour, what C++ does and does not allow you to do (and why), and what the performance implications are. In the process, we will cover important C++ concepts such as object lifetime, object representation, and aliasing rules.


Наши контакты