~/talk

Back to Basics: Pointers and Memory

Talkat CppCon 2020 · 2020-09-14..09-18· [c-and-cpp]
name:Ben Saks
links:none on file
slides:none on file

Explains exact rules: arrays decay to pointers only in expressions and not on assignment, pointer arithmetic advances by sizeof(element) so p + k moves k elements, subtracting pointers yields a signed ptrdiff_t, and sizes use unsigned size_t (causing signed/unsigned pitfalls); prefers nullptr over NULL; array parameters are actually pointers; references are non-reseatable aliases with no null value; converting between unrelated pointer types requires casts and can produce undefined behavior; examples use sizeof, pointer increments, and pointer subtraction.

AI-written summary · about

  1. 0:00Introduction
  2. 1:15Raw pointers vs smart pointers
  3. 3:04When to use raw pointers
  4. 4:28Pointer basics
  5. 9:55Dangling pointers
  6. 12:06Arrays and pointer arithmetic
  7. 21:46Array vs pointer distinction
  8. 27:30Size_t and ptrdiff_t
  9. 38:07Pointer type conversions
  10. 44:14Other pointer conversions
  11. 51:03Pointer to void conversions
  12. 56:05References vs pointers
  13. 1:00:02Summary
~/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.