dynamic_cast requires RTTI flag when do compiling, the RTTI will increase object size. and RTTI only generate for polymorphic classes.

class A {

public:

std::string m_Data;

}

although A class is not polymorphic, but the m_Data is a instance of polymorphic class, the sizeof(A) will change when compile with/without RTTI. programmer should be very carefully when link with third-party library, it is more difficult to find out the crash compare to pack problem. a web page talking about class layout (VS compiler), but could be reference for other platform. http://www.openrce.org/articles/full%5Fview/23