Summary
This episode addresses the potential dangers of using std::string_view, std::span, and other non-owning reference types in C++. Jason demonstrates how easy it is to create undefined behavior when these views outlive their referenced data, particularly when returning local temporary objects. He explains that while Clang can sometimes catch these issues with warnings, GCC typically doesn't, making AddressSanitizer an essential tool for detecting these problems at runtime.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[mdspan]100% match