Possible Duplicate:
C++ When should we prefer to use a two chained static_cast over reinterpret_cast
Which is better?
static_cast<T *>(static_cast<void *>(buffer));
or
reinterpret_cast<T *>(buffer);
Where buffer
is char *
(memory chunk which contains values of type T
).
The chain of two static_cast
s is better - it is less implementation dependent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With