I have always avoided the C++ casts (static_cast
, const_cast
, dynamic_cast
[I also avoid RTTI], etc) because I regard them as a waste of typing and I never saw any advantages, so I use C-style casts exclusively.
My question is, if you have an inheritance hierarchy and a pointer to the base type, can you safely cast a base pointer to a derived pointer with a C-style cast (provided that somehow you are absolutely sure the base pointer points to an instance of a derived type) without something happening behind the scenes that will cause seemingly inexplicable failures?
I ask this because I read in one of the comments on another question that using a C-style cast from a base to a derived type will not "adjust the pointer" or something like that. I'll try to find the exact comment again.