c++中的类型转换--reinterpret_cast

原文链接:  浅析c++中的类型转换--reinterpret_cast 转换

reinterpret_cast作用为:
允许将任何指针转换为任何其他指针类型。 也允许将任何整数类型转换为任何指针类型以及反向转换。

看着上面的描述就有种放浪形骸的赶脚。更会让人不寒而栗,太随意!

语法还是老样子:
reinterpret_cast < type-id > ( expression )

滥用 reinterpret_cast 运算符可能很容易带来风险。 除非所需转换本身是低级别的,否则应使用其他强制转换运算符之一。




原文地址:https://www.cnblogs.com/wishchin/p/9199848.html