From Jason Turner
Watch on YouTube

Summary

This episode explains why pointer arithmetic should be avoided in modern C++ code. Jason demonstrates how easy it is to introduce undefined behavior through pointer operations, such as accessing beyond array bounds or assuming null-termination in strings. He explains that pointer arithmetic doesn't simply add the numeric value, but instead advances the pointer by the size of the pointed-to type, which can lead to subtle, hard-to-detect bugs. The episode advocates for using safer abstractions like std::string_view and std::span that manage ranges properly without raw pointer manipulation.

Resources

Tags