Summary
This episode examines potential dangers when using GNU's function attributes `pure` and `const`. Using Compiler Explorer, Jason demonstrates how incorrectly applying the `pure` attribute to a function that modifies object state can lead to unexpected behavior. He shows that when a member function that increments an internal counter is marked as `pure`, the compiler assumes it has no side effects and may optimize away function calls entirely. This optimization happens even at low optimization levels, resulting in incorrect program behavior without any warnings from the compiler.