5:00 PM Saturday
Fireside B
Silicon Valley Code Camp : October 7 & 8, 2017session

dynamic_cast From Scratch

Join Arthur O'Dwyer on a tour of the C++ object model, from simple structs to multiple and virtual inheritance; covering virtual method calls, vtables, RTTI, and the uses of the `final` qualifier.

About This Session

This session will introduce you to the C++ object model: the rules by which C++ class objects are translated into memory layouts. We'll move from simple structures to polymorphic class types, then onward to multiple and virtual inheritance. We'll discuss the anatomy of a virtual method call, the difference between `static_cast` and `reinterpret_cast`, and what's contained in a vtable besides function pointers. The climax will be a complete implementation of C++'s built-in `dynamic_cast`, using our own hand-crafted artisanal run-time type information (RTTI). We'll see that the way `dynamic_cast` thinks about the class hierarchy is slightly different from the way we're used to drawing it!
Attendees will incidentally be exposed to several features of the modern C++ language, including type traits, the `final` qualifier, and the library type `std::variant`.
This session will mostly be talking about the Itanium C++ ABI, which is the standard on Linux and OS X systems. Mapping these concepts to the MSVC ABI will be left as an exercise for the reader.

Time: 5:00 PM Saturday    Room: Fireside B 

The Speaker(s)

undefined undefined

Arthur O'Dwyer

Staff Software Engineer , Nominum

Arthur has spoken at CppCon, C++Now, and SVCC, and is writing a book about the C++ Standard Library.