CppCon 2020 has ended
Back To Schedule
Tuesday, September 15 • 09:00 - 10:00
Back to Basics: Pointers and Memory

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
The prevailing wisdom in Modern C++ is to favor smart pointers and container classes over raw pointers and built-in arrays -- there are too many traps and pitfalls that come with using those more-primitive types. However, many C++ programmers can’t avoid using them because they’re still so prevalent in legacy C++ code and C libraries. If you have to use raw pointers and built-in arrays, then you should learn to use them safely and effectively.

This session explains the true nature of built-in pointers and arrays, and why they’re so easily confused despite actually being distinct types. It covers the rules for pointer and array type conversions, along with the mechanics of pointer arithmetic and array subscripting. It compares and contrasts pointers with references and iterators, as well as the pointer and reference member types in the STL, to help you make more informed choices about what to use when. This session also explains the origins of the types size_t and ptrdiff_t, and their relationship to size and difference types in the STL.

You’ll leave with a clearer understanding of how pointer operations behave, whether you’re using raw pointers and built-in arrays or smart pointers and container classes.

avatar for Ben Saks

Ben Saks

Chief Engineer, Saks & Associates

Tuesday September 15, 2020 09:00 - 10:00 MDT
Back to Basics