Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++multiple and virtual inheritance layoutSingle-choice MCQ

Under the Itanium ABI, when you static_cast a pointer-to-derived to a pointer-to-second-non-virtual-base, the pointer value changes by a fixed offset. What does the compiler do when that source pointer might be null?

struct A { long a; }; struct B { long b; }; struct D : A, B {}; B* pb = static_cast<B*>(pd); // pd may be nullptr