Undefined Behavior is Awesome
Undefined behavior (UB) is one of the features of C++ that is both loved and hated. Every C++ developer cares about performance, which is why it is very important to understand what the compiler can optimize and what are the language guarantees. Many times programmers are too optimistic about what the compiler can optimize, or they waste time optimizing code by hand.
In this talk you will learn:
– what is the “as-if” rule
– why compilers know less than the programmer — the main problem with Translation Units
– why compilers optimize based on UB, but don’t warn about it
– why Undefined Behavior can transcend time, removing your whole code without running 88mph
– why having a more constrained language is better — optimizations that you can’t do in C