From Jason Turner
Watch on YouTube

Summary

This episode explores C++23's new [[assume]] attribute, which allows developers to give the compiler hints about guaranteed conditions in their code. Jason demonstrates how [[assume]] can enable significant optimizations by eliminating code paths that would never execute under the assumed conditions. Through practical examples, he shows how this attribute can remove null pointer checks when developers have a contract that guarantees non-null pointers, potentially improving performance in critical code paths by avoiding exception handling and branch prediction failures.

Resources

Tags