<<< Pure interfaces | Index | Safer casting with static_cast >>> |
Consider:
int* ptr = (int*) x;
C++ inherited (type)x -style conversion from C.
The above declaration of ptr can be quite dangerous, because:
it is hard to spot or find in a large program;
the kind of converison is not explicit: the types could be
related (x is also a pointer type),
unrelated (x is not a pointer);
it can be portable;
it can be non-portable.
Is there a better way of casting?
<<< Pure interfaces | Index | Safer casting with static_cast >>> |