One of the motto of C++ is « costless abstractions », a.k.a. you only pay for what you use. To achieve this goal, modern C++ puts a heavy burden on the compiler. But what does the compiler really does when it meets an exception? When it finds a nested lambda? When it encounters a structure that wraps a single scalar?
During this talk, we'll go trough a set of innocent C++ sample that involves several data types and algorithms from the standard library, and verify that the costless abstraction principle holds, especially when looking at the difference between several optimization level, eventually digging into specific compiler optimization to understand what happens under the hood.
This talk uses Clang++ as the reference compiler, and relies on its LLVM bitcode output to explain how the abstractions are lowered (or completely pruned) at the Intermediate Representation level.