避免int 与 pointer的隐式类型转换
时间:2011-03-11 来源:nickolas
隐式类型转换是C++一个很不安全的特性,经常给调试程序制造麻烦.
一个避免int和指针间隐式类型转换的技巧是使用const int, 因为没有pointer 到 const int 的implicit cast ,当然经常需要配合使用const_cast<T>()和multiable.
相关阅读 更多 +
排行榜 更多 +
时间:2011-03-11 来源:nickolas
隐式类型转换是C++一个很不安全的特性,经常给调试程序制造麻烦.
一个避免int和指针间隐式类型转换的技巧是使用const int, 因为没有pointer 到 const int 的implicit cast ,当然经常需要配合使用const_cast<T>()和multiable.