static_cast
-
Does static_cast<> produce any code or
class_A_ptr *a = static_cast < class_B_ptr * > (b);
is equal to
class_A_ptr *a = (class_B_ptr *)b;
? With the best regards, Vitaly.
-
Does static_cast<> produce any code or
class_A_ptr *a = static_cast < class_B_ptr * > (b);
is equal to
class_A_ptr *a = (class_B_ptr *)b;
? With the best regards, Vitaly.
the newstyle casts are basically the same as the oldstyle casts, except the results are more clearly defined. (class_B_ptr*) is actually a combination of several kinds of casts, const_cast and static_cast depending on situation. there is also dynamic_cast and reinterpret_cast, which all do different things, and only very specific things (unlike the oldstyle casts which would often allow you to do something you didn't intend to do). static_cast can sometimes generate code, for instance, when casting an object with multiple vtables, the vtable is adjusted when you cast it. but generally speaking it usually does not.
-
the newstyle casts are basically the same as the oldstyle casts, except the results are more clearly defined. (class_B_ptr*) is actually a combination of several kinds of casts, const_cast and static_cast depending on situation. there is also dynamic_cast and reinterpret_cast, which all do different things, and only very specific things (unlike the oldstyle casts which would often allow you to do something you didn't intend to do). static_cast can sometimes generate code, for instance, when casting an object with multiple vtables, the vtable is adjusted when you cast it. but generally speaking it usually does not.