Session Details

dynamic_cast From Scratch  

Level :
Intermediate
Date :
5:00 PM Saturday
Room :
Fireside B
Track :
C++
Interested : (-) - Registered : (-)

Presentation

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.

The Speaker(s)

img

Arthur O'Dwyer

Arthur O'Dwyer worked for many years at Green Hills Software, making the world's most optimizing C and C++ compilers. These days he makes DNS servers at Nominum, speaks at C++ conferences, and is writing a book about the C++ Standard Library.
  • Not Interested
  • Interested
  • Attending

SPONSORS List