David said:
I should have added the qualification: for conversions that "are
inherently unsafe and often implentation dependent" and return "a
value that is a crude reinterpretation of its argument".
It is my understanding that the purpose of static_cast and reinterpret_cast
was to *prevent* the C-style cast from acting like a reinterpret_cast.
For instance, say we have a class A, and a class B : A, and A *pa and B *pb;
pa = (A*)pb; // up-cast B* to A*
This has the desired result. However, if we later change the type of pb or
pa, or change B so it doesn't inherit from A anymore, the above code still
compiles and runs but has a completely undesirable effect (it would do the
same as a reinterpret_cast now). Had we written:
pa = static_cast<A*>(pb);
The code wouldn't have compiled anymore after such changes.
(and of course for downcasts dynamic_cast is even better)
If that wasn't (part of) the rationale behind static_cast, it's a bloody
nice side-effect.
--
Unforgiven
"Earth. It exists only in a corner of my memory."
Lord Dornkirk
The Vision of Escaflowne