reinterpre_cast 作用

来源:百度知道 编辑:UC知道 时间:2024/09/24 22:20:45
他可以 转换类型
但是 有什么具体作用?

为什么要 设置他

这是MSDN中的解释
The reinterpret_cast operator allows any pointer to be converted into any other pointer type. It also allows any integral type to be converted into any pointer type and vice versa. Misuse of the reinterpret_cast operator can easily be unsafe. Unless the desired conversion is inherently low-level, you should use one of the other cast operators.

大意如下
reinterpret_cast操作符允许任何指针转换为其他类型的指针。同样允许整形转换为指针类型,反之亦然

reinterpret_cast使用不当很容易造成危险
如果希望你的转换继承于低危险级别,建议你使用其他操作符