Have you registered for CppCon 2018 in September? Early bird registration is open now.
While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:
dynamic_cast From Scratch
by Arthur O'Dwyer
Summary of the talk:
This session will introduce you to the C++ object model: the rules by which C++ class objects are translated into memory layouts. We'll quickly cover polymorphic class types and 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. 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; and that `dynamic_cast` is expensive enough that sometimes we can find cheaper ways to ask an object for its type! The climax will be a complete, bug-free, and fast implementation of C++'s built-in `dynamic_cast`, using our own hand-crafted artisanal run-time type information (RTTI).
Attendees will incidentally be exposed to several features of the modern C++ language, including type traits and the `final` qualifier.
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 of the project's GitHub repo: https://github.com/Quuxplusone/from-s...
Add a Comment
Comments are closed.