1. What is the difference about static_cast and reinterpret_cast
2. Can the data type of a pointer be explicitly converted. I tried doing a conversion with static_cast and reinterpret_cast
1. What is the difference about static_cast and reinterpret_cast
2. Can the data type of a pointer be explicitly converted. I tried doing a conversion with static_cast and reinterpret_cast
There are more details than this, but the meat as quoted from the C++ standard:Originally Posted by mdennis10
- An expression e can be explicitly converted to a type T using a static_cast of the form static_cast<T>(e) if the declaration “T t(e);” is well-formed, for some invented temporary variable t.
- The mapping performed by reinterpret_cast is implementation-defined. [Note: it might, or might not, produce a representation different from the original value. ]
Converted from what to what?Originally Posted by mdennis10
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)