~/talk

To Int or to Uint, This is the Question

Talkat Core C++ 2023 · 2023-06-05..06-07· [c-and-cpp]
links:none on file
slides:none on file

Compares signed vs unsigned on x86 with gcc 13 -O2 and shows concrete assembly: uint64 uses a logical shift; int64 compiles into add + arithmetic shift, so division-by-2 costs extra ops. Demonstrates an arithmetic-series sum where signed version is 40× faster than unsigned on that toolchain. Recommends -fsanitize=signed-integer-overflow, fixed-width helpers (make_signed/make_unsigned, int_fast_t), C++20 two’s-complement guarantee and C++23 ssize, and using safe comparisons, concrete types and strong wrappers to avoid UB.

AI-written summary · about

  1. 0:00Welcome and introduction
  2. 1:08Why integers matter
  3. 3:36Simple example comparison
  4. 5:43Assembly basics
  5. 8:59Latency and performance
  6. 11:52Signed vs unsigned storage
  7. 14:00Signed integer representations
  8. 16:32Shift operations explained
  9. 18:41Performance results
  10. 19:02Integer promotion pitfalls
  11. 22:40Mixing types causes bugs
  12. 24:28Avoid abusing auto
  13. 25:31Literal types explained
  14. 26:16Size_t and portability
  15. 28:47Pop quiz overflow
  16. 30:10Arithmetic series performance
  17. 35:12Undefined behavior trade-offs
  18. 36:34Compiler optimizations
  19. 37:16Sanitizers for safety
  20. 38:20Fixed-width integer types
  21. 39:23Generic programming helpers
  22. 40:47Safe comparisons in C++20
  23. 42:11Performance vs correctness
  24. 43:17Avoid auto when unsure
  25. 43:38Modern loops and safety
  26. 44:21Strong types recommendation
  27. 45:31Compiler warnings matter
  28. 47:38Best type for math
  29. 48:41Exploiting undefined behavior
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.