~/talk

“The Importance of Being const"

Talkat CppCon 2015 · 2015-09-21..09-25· [c-and-cpp, concurrency]
links:none on file
slides:none on file

Explains that const enforces invariants at compile time but in C++11 also carries a const implies data-race-free guarantee so mutable caching or logging inside const member functions can create subtle races. Shows a concrete checksum cache bug where copy construction and member initialization order produce wrong cached values, demonstrates fixing counters with use std::atomic for counters or mutexes (noting they make objects noncopyable), recommends writing types as T const name and says const helps correctness not automatic optimization.

AI-written summary · about

  1. 0:00Introduction
  2. 1:05What is const
  3. 2:50Pointer const rules
  4. 10:28Const with structs
  5. 15:12Const in function calls
  6. 17:43Const member functions
  7. 20:16Const and invariants
  8. 24:35Const member function rules
  9. 25:59Logical vs bitwise const
  10. 27:27Mutable for caching
  11. 29:12Thread safety with const
  12. 35:14Caching in const functions
  13. 45:29Does const optimize code
  14. 48:22Summary and best practices
  15. 49:22Q&A
~/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.