~/talk

Enough string_view to hang ourselves

Talkat NDC Oslo 2018 · 2018-06-11..06-15· [c-and-cpp, web-platform]
slides:none on file

Case study on a 15‑year Windows app, Advanced Installer, modernized to C++17 with clang tooling shows std::string_view saves copies but causes real bugs: storing views in a vector led to dangling references, implicit null‑terminated constructors cost runtime, and auto return type can deduce string_view causing use‑after‑free. Uses include clang‑tidy checks (enable bugprone‑dangling‑handle) and LLVM/Clang tools; guidance is to pass string_view by value for parameters, avoid persisting views in containers, use transparent comparators for maps, and follow proposals like P0936 for safer semantics.

AI-written summary · about

  1. 0:00Start
  2. 10:30C + + 17 String View
  3. 12:35Why Are We Trying To Avoid Temporary Strings
  4. 15:12Costly Constructor
  5. 15:52Standard String
  6. 22:18Explicit Constructor for Standard String
  7. 28:25Detecting Dangling References as Handles To Swing Views
  8. 43:07What Is a Borrow Type
  9. 49:34Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.