Chapter 11: Undefined Behavior and Performance
This chapter has a dual focus. On the one hand, it explains the dangers of the kinds of undefined behavior that programmers often ignore when attempting to squeeze the most performance from their code. On the other hand, it explains how to take advantage of the undefined behavior to improve performance and how to properly specify and document such situations. Overall, the chapter offers a somewhat unusual but more relevant way to understand the issue of the undefined behavior compared to the usual "anything can happen."
In this chapter, we will cover the following topics:
- Understanding undefined behavior and why it exists
- Understanding the truth versus the myths about undefined behavior
- Which undefined behavior is dangerous and must be avoided
- How to take advantage of undefined behavior
- Learning the connection between undefined behavior and efficiency and how to exploit it
You will learn to...