<<< Safer casting with dynamic_cast | Index | const cast away: const_cast >>> |
The reinterpret_cast handles conversions between unrelated types, such as int to ptr*, etc.
It produces value of a requested type with the same bit pattern.
Use reinterpret_cast when you know you are doing something correct, and don't need the compiler to check:
static const unsigned int IO_PORT_A = 0x00fc; Port* io_port = reinterpret_cast< Port* > IO_PORT_A;
Using reinterpret_cast most likely is not portable!
<<< Safer casting with dynamic_cast | Index | const cast away: const_cast >>> |