Jonathan Müller
C++ Features You Might Not Know
#1about 1 minute
Understanding commutative array indexing in C++
The built-in array index operator is commutative because it is defined in terms of pointer arithmetic, allowing for unusual but valid syntax like `index[array]`.
#2about 1 minute
Using the unary plus operator for type promotion
The unary plus operator can be used to trigger integral promotions, convert enums to their underlying type, and decay arrays or lambdas to function pointers.
#3about 1 minute
Leveraging the comma operator with fold expressions
The comma operator evaluates expressions from left to right, making it a powerful tool for applying an operation to each element of a parameter pack using a fold expression.
#4about 4 minutes
Exploring quirks in C++ control flow syntax
The `else if` construct is just an `else` followed by an `if` statement, and `switch` statements allow for unusual structures like placing the default case first or implementing Duff's device.
#5about 2 minutes
Handling floating-point exceptions and NaN values
C++ provides functions to test for floating-point exceptions like division by zero and to create specific "Not a Number" (NaN) values, which can be used for techniques like NaN boxing.
#6about 1 minute
The flexibility of declaration specifier order
Declaration specifiers like `const`, `unsigned`, `static`, and `inline` can appear in any order before the type name, allowing for unconventional but valid declarations.
#7about 1 minute
Decoding complex C++ declarators
The declarator part of a declaration, which includes the name and operators like `*` or `()`, can be combined to declare pointers, variables, and functions in a single statement.
#8about 1 minute
Using function try blocks in constructors
Function try blocks are essential for catching exceptions thrown from a constructor's member initializer list, as a regular try-catch block cannot surround it.
#9about 1 minute
The overlooked `std::valarray` for vector math
`std::valarray` is a standard library container designed for efficient, element-wise numerical operations and can be a good alternative to custom vector types for mathematical computations.
#10about 1 minute
Finding the most derived object with `dynamic_cast`
Using `dynamic_cast<void*>` on a pointer to a base class returns the address of the most derived object in the hierarchy, which is useful for type-erasure implementations.
#11about 2 minutes
Leveraging the common initial sequence in unions
The common initial sequence rule allows reading non-active members of a union if they share the same initial layout, enabling space optimization by overlaying common fields.
#12about 2 minutes
Undefined behavior in signed integer arithmetic
Signed integer overflow is undefined behavior in C++, which can occur not only in addition and multiplication but also in specific division cases like `INT_MIN / -1`.
#13about 3 minutes
The `sizeof` operator precedence puzzle
The `sizeof` operator has lower precedence than the array index operator, leading to surprising results where `sizeof +a[i]` is parsed as `sizeof(+(a[i]))`.
Related jobs
Jobs that call for the skills explored in this talk.
MARKT-PILOT GmbH
Stuttgart, Germany
Remote
€75-90K
Senior
Java
TypeScript
+1
Hubert Burda Media
München, Germany
€80-95K
Intermediate
Senior
JavaScript
Node.js
+1
Picnic Technologies B.V.
Amsterdam, Netherlands
Intermediate
Senior
Python
Structured Query Language (SQL)
+1
Matching moments
01:32 MIN
Organizing a developer conference for 15,000 attendees
Cat Herding with Lions and Tigers - Christian Heilmann
04:57 MIN
Increasing the value of talk recordings post-event
Cat Herding with Lions and Tigers - Christian Heilmann
04:49 MIN
Using content channels to build an event community
Cat Herding with Lions and Tigers - Christian Heilmann
03:17 MIN
Selecting strategic partners and essential event tools
Cat Herding with Lions and Tigers - Christian Heilmann
02:39 MIN
Establishing a single source of truth for all data
Cat Herding with Lions and Tigers - Christian Heilmann
02:44 MIN
Rapid-fire thoughts on the future of work
What 2025 Taught Us: A Year-End Special with Hung Lee
03:38 MIN
Balancing the trade-off between efficiency and resilience
What 2025 Taught Us: A Year-End Special with Hung Lee
03:39 MIN
Breaking down silos between HR, tech, and business
What 2025 Taught Us: A Year-End Special with Hung Lee
Featured Partners
Related Videos
101 brilliant things of C++
Andreas Fertig
C++ in constrained environments
Bjarne Stroustrup
Functional Programming in C++
Jonathan Müller
The Design and Evolution of C++
Bjarne Stroustrup
An (In-)Complete Guide to C++ Object Lifetimes
Jonathan Müller
Programming secure C#/.NET Applications: Dos & Don'ts
Sebastian Leuer
Best of the Worst – the most awful anti-features in JavaScript, ranked!
Peter Kröner
The C++ rvalue lifetime disaster
Arno Schoedl
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.






Modus Create
Zürich, Switzerland
Remote
Senior
API
Erlang
Clojure
Blockchain
+2


Bertrandt AG
München, Germany
QT
C++
Linux
OpenGL
Software Architecture
